Repository navigation
fix: pass tool annotations to McpServer.tool() before the callback - #267
vishalhabib99 wants to merge 1 commit into
Conversation
idosal#210 added readOnlyHint/destructiveHint annotations, but they were passed after the callback, wrapped in { annotations }. McpServer.tool() only reads annotations between paramsSchema and the callback, so the trailing argument was ignored and tools/list returned no annotations. Fixes idosal#266 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VOUCHAVOUCHA is currently in early access and is not enabled for this repository yet. To request access, contact @idosal. VOUCHA has not added a comprehension check to this PR. |
|
Hi @idosal, gentle ping on this. It fixes #266: the |
|
We independently audited This PR correctly re-orders the parameters passed to Clean fix! 👍 |
Fixes #266.
#210 added
readOnlyHint: true/destructiveHint: falseto the tools, but the live server doesn't return them.src/index.tspassed them after the callback, wrapped in{ annotations }. In the locked SDK (1.11.2),McpServer.tool()only reads annotations betweenparamsSchemaand the callback, then treatsrest[0]as the callback, so the trailing argument was silently dropped.This passes the annotations object itself, in the position the SDK expects (
tool(name, description, paramsSchema, annotations, cb), an overload in the 1.11.2 type definitions). Tools without annotations are registered exactly as before.Tested against
@modelcontextprotocol/sdk@1.11.2: tools registered both ways, then listed through a realClientoverInMemoryTransport:I didn't run the Worker end to end (
wrangler dev), so a quicktools/listagainst a preview deploy would confirm it live.Why it matters: without annotations, clients fall back to the spec defaults (
readOnlyHint: false,destructiveHint: true), so cautious hosts treat every documentation fetch as potentially destructive and may ask for approval on each call.🤖 Generated with Claude Code