Skip to content

Migrate to registerTool with annotations, titles, and structured output (roadmap 0.2.0) #39

Closed

Description

@TMHSDigital

Why it matters

MCP clients decide how to treat a tool from its annotations. The spec says unannotated tools should be assumed destructive and non-idempotent, so read-only calls like tailnet_status get over-confirmed, and clients can't distinguish share_port {public:true} (opens a port to the internet) from a status read. Annotations are the cheapest safety and UX win available, and they're listed as roadmap item 0.2.0. This issue tracks that work.

Evidence

  • All tools use the deprecated server.tool(name, description, shape, handler) overload (src/tools/*.ts). SDK 1.32 provides server.registerTool(name, { title, description, inputSchema, outputSchema, annotations }, handler).
  • Responses are JSON stringified into a text block (src/tools/helpers.ts:9-11), with no structuredContent or outputSchema, so clients and agents re-parse text.

Suggested approach

  1. Migrate every tool to registerTool and add a human-friendly title.
  2. Annotations:
    tool readOnly destructive idempotent openWorld
    tailnet_status, share_status, ping_all ✓ ✓
    generate_ssh_config ✗ (writes when write) ✗ ✓
    share_port ✗ ✗ ✓ ✓ (Funnel)
    stop_share ✗ ✓ ✓
  3. Add outputSchema (zod) and return structuredContent alongside the text block for backward compatibility.
  4. Regenerate mcp-tools.json (see Generate mcp-tools.json from the server and fail CI on drift (it is already out of sync) #36) and document the annotations in the README.

Done when

listTools() shows titles, annotations, and output schemas for every tool, the tests assert them, and no deprecated server.tool calls remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority: P1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions