Native lookup has no relevance ranking or pagination

未关闭
#56 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
github-actions, lua, python
领域
api, tooling

调研方向

Start in mcp-server/tools/natives.py, where lookup_native applies an unranked substring filter and _format_results caps output at show_limit = 25, then check the lookup_native_tool signature in mcp-server/server.py. Deprecation parsing lives in .github/scripts/transform_natives.py near line 197. There is no test suite, so verify by running the MCP server and calling the lookup. Done means exact-name matches rank first, limit and offset page results, and deprecated natives expose a replacement.

由索引模型根据 Issue 内容生成。

描述

enhancement severity: medium

Summary

lookup_native_tool returns matches in file (alphabetical) order and cuts them at 25 with no offset. Broad queries hide the most relevant natives, deprecated natives do not expose their replacement in a structured way, and the output is prose only.

Where

  • mcp-server/tools/natives.py:46-62 (lookup_native, unranked substring filter)
  • mcp-server/tools/natives.py:104-141 (_format_results, show_limit = 25)
  • mcp-server/server.py:51-66 (lookup_native_tool signature)
  • .github/scripts/transform_natives.py:197 (deprecation detection)

Details

  • lookup_native("vehicle") returns "Found 1077 native(s)" and shows only the first 25 alphabetical names, followed by "Narrow your search". There is no limit or offset.
  • A name match ranks the same as a description match.
  • For deprecated natives the replacement appears only as a markdown link inside the description text (for example use [HINT_SCRIPT_AUDIO_BANK](#\_0xFB38...)), with no replaced_by field.

SCREAMING_SNAKE name matching is tracked in "lookup_native returns nothing for canonical SCREAMING_SNAKE native names".

Impact

For partial or broad queries the native the agent wants is often past the cutoff and unreachable without guessing a narrower string. Agents cannot reliably follow a deprecation to its replacement or parse results.

Suggested fix

  • Score matches: exact name, then name prefix, then name substring, then category, then description; sort by score.
  • Add limit (default 25, max 100) and offset parameters.
  • In transform_natives.py, extract the linked replacement into a replaced_by field and render it as "Use X instead".
  • Add an optional format="json" that returns the raw records.

Acceptance criteria

  • An exact-name query lists that native first even when many others match the description.
  • offset pages through results beyond the first 25.
  • Deprecated natives with a known replacement show it.
  • format="json" returns parseable records.

Getting started

  • Relevant files: mcp-server/tools/natives.py, mcp-server/server.py, .github/scripts/transform_natives.py
  • How to run checks: there is no test suite yet; run the MCP server with cd mcp-server && pip install -r requirements.txt && python server.py, and CI checks live in .github/workflows/validate.yml
  • Related docs: skills/native-functions/SKILL.md

Filed by repo-audit/full-audit at 701824d. Severity: medium. Effort: S. audit-key: enhancement|mcp-server/tools/natives.py|ranking

主要语言
Python
星标
7
派生
4
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/CFX-Developer-Tools 的其他 Issue

查看 TMHSDigital/CFX-Developer-Tools 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。