Skip to content

fix: add annotation titles to all MCP tools (#149)#172

Merged
mattzcarey merged 3 commits into
mainfrom
fix/issue-149-1783012821
Jul 6, 2026
Merged

fix: add annotation titles to all MCP tools (#149)#172
mattzcarey merged 3 commits into
mainfrom
fix/issue-149-1783012821

Conversation

@agent-think

@agent-think agent-think Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Closes #149

What was wrong

The MCP server exposed tools without consistent annotations.title values. In Code-Mode the SDK-derived tool registrations for docs, search, and execute only set descriptions/inputs, and the non-Code-Mode precomputed artifact generated in src/openapi.ts did not produce a human-readable title for any of the ~3,000 endpoint tools. Clients that prefer title (or annotations.title) over the raw tool name therefore showed machine-oriented labels like get_accounts_workers_scripts.

What changed

  • Added explicit title and annotations.title to every Code-Mode tool:
    • docs → "Cloudflare Docs Search" (src/tools/docs-search.ts)
    • search → "Cloudflare API Spec Search" (src/tools/search.ts)
    • execute → "Cloudflare API Code Executor" (src/tools/execute.ts)
  • Added a generated title to each non-Code-Mode endpoint tool by introducing toolNameToTitle in src/openapi.ts and threading it through NonCodemodeTool/buildNonCodemodeTools/toWireTool (src/tools/non-codemode.ts). The title title-cases the stable machine name and keeps common prepositions lower-case (e.g. get_accounts_workers_scripts_by_script_name → "Get Accounts Workers Scripts by Script Name").
  • Updated attachMetrics in src/metrics.ts to mirror tool.title into annotations.title when only a top-level title is supplied, ensuring both fields are populated consistently without manual duplication.
  • Added/updated tests covering:
    • docs title and annotations.title
    • search and execute titles via the real worker
    • Non-Code-Mode endpoint titles
    • toolNameToTitle formatting including by suffix

Raw tool names remain unchanged, preserving machine invocation stability.

Testing

  • npm run lint — clean
  • npm run format:check — clean
  • npm run typecheck — clean
  • npm run test -- --run271 tests passed

🤖 generated by the pr-agent — please review carefully

@mattzcarey mattzcarey merged commit fe731a8 into main Jul 6, 2026
5 checks passed
@mattzcarey mattzcarey deleted the fix/issue-149-1783012821 branch July 6, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add annotation titles to all MCP tools

1 participant