#266·git-mcp

Tool annotations from #210 never reach clients (passed after the callback)

Author: vishalhabib99Created Sep 23, 2026Updated Sep 23, 2026

#210 added readOnlyHint: true to every tool, but the live server doesn't return any of them. tools/list on https://gitmcp.io/docs (checked 2026-09-22) returns no annotations on any of its 5 tools. On https://gitmcp.io/modelcontextprotocol/python-sdk, 3 of 4 have none and fetch_python_sdk_documentation has an empty {}.

Cause: src/index.ts passes the annotations after the callback, wrapped in an extra object:

typescript
this.server.tool(
  tool.name,
  tool.description,
  tool.paramsSchema,
  async (args: any) => tool.cb(args),
  tool.annotations ? { annotations: tool.annotations } : undefined,
);

In the locked SDK (1.11.2), McpServer.tool() only looks for annotations between paramsSchema and the callback, and then takes rest[0] as the callback, so the trailing argument is silently ignored (mcp.ts#L676-L694).

Why it matters: the spec defaults are readOnlyHint: false and destructiveHint: true. So clients have to treat fetch_generic_documentation, search_generic_code and the rest as possibly destructive, and cautious hosts will ask for approval on every call.

Likely fix (untested): pass the annotations object itself, before the callback:

typescript
const cb = async (args: any) => tool.cb(args);
if (tool.annotations) {
  this.server.tool(tool.name, tool.description, tool.paramsSchema, tool.annotations, cb);
} else {
  this.server.tool(tool.name, tool.description, tool.paramsSchema, cb);
}

Found this during a metadata-only survey of 10 hosted MCP servers (only initialize + tools/list, no tool calls): https://github.com/vishalhabib99/mcp-trust-check/tree/main/docs/hosted-survey-2026-09