Skip to content

Migrate tools from deprecated server.tool() to registerTool with annotations #122

Closed

Description

@TMHSDigital

Summary

All 51 tools register with server.tool(name, description, schema, handler), the deprecated overload in @modelcontextprotocol/sdk 1.x, while the newer prompts.ts and resources.ts use registerPrompt / registerResource. Because of this no tool declares MCP tool annotations, even though the code already knows which tools are read-only and which 11 are destructive.

Where

  • every file in mcp-server/src/tools/*.ts (for example piReboot.ts:12)
  • mcp-server/src/prompts.ts:64, mcp-server/src/resources.ts:11

Impact

  • Clients cannot tell read-only tools from destructive ones, so they cannot auto-approve safe calls or warn before destructive ones.
  • Two registration styles in one codebase; a future SDK major that drops the overload breaks all tools at once.

Suggested fix

  1. Migrate each tool to server.registerTool(name, { title, description, inputSchema, annotations }, handler) (mechanical, one commit per group of tools).
  2. Set annotations.readOnlyHint: true on read-only tools and destructiveHint: true on the confirm-gated ones (idempotentHint where it applies).
  3. Update the test harness that captures handlers (confirm-gates.test.ts, input-validation.test.ts, registration.test.ts) and assert the annotation per tool.

Acceptance criteria

  • No server.tool( calls remain.
  • Every tool has annotations, enforced by registration.test.ts.

Getting started

  • Relevant files: mcp-server/src/tools/, mcp-server/src/tools/__tests__/registration.test.ts
  • How to run tests: cd mcp-server && npm install && npm test

Filed by repo-audit/full-audit at a59395f. Severity: low. Effort: M. audit-key: tech-debt|mcp-server/src/tools|server.tool

Activity

  1. added
    help wanted
    tech-debt
    severity: low
    on Nov 18, 2026
  2. TMHSDigital commented on Nov 18, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 140c514 (released in 0.22.1). Every tool now registers with server.registerTool(name, { description, inputSchema, annotations }, handler); annotations come from utils/annotations.ts (39 read-only, 12 destructive confirm-gated, 2 state-changing: composePull and ntfySend).

    Verified: registration.test.ts asserts each tool's annotations and that no server.tool( call remains; the built server lists all 53 tools over stdio with the expected annotations. CI passed on ubuntu (Node 22, 24) and Windows.

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

    help wantedmcp-serverseverity: lowtech-debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions