fix: add annotation titles to all MCP tools (#149)#172
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #149
What was wrong
The MCP server exposed tools without consistent
annotations.titlevalues. In Code-Mode the SDK-derived tool registrations fordocs,search, andexecuteonly set descriptions/inputs, and the non-Code-Mode precomputed artifact generated insrc/openapi.tsdid not produce a human-readable title for any of the ~3,000 endpoint tools. Clients that prefertitle(orannotations.title) over the raw tool name therefore showed machine-oriented labels likeget_accounts_workers_scripts.What changed
titleandannotations.titleto 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)titleto each non-Code-Mode endpoint tool by introducingtoolNameToTitleinsrc/openapi.tsand threading it throughNonCodemodeTool/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").attachMetricsinsrc/metrics.tsto mirrortool.titleintoannotations.titlewhen only a top-level title is supplied, ensuring both fields are populated consistently without manual duplication.docstitle andannotations.titlesearchandexecutetitles via the real workertoolNameToTitleformatting includingbysuffixRaw tool names remain unchanged, preserving machine invocation stability.
Testing
npm run lint— cleannpm run format:check— cleannpm run typecheck— cleannpm run test -- --run— 271 tests passed🤖 generated by the pr-agent — please review carefully