8000 [Feature]: Add Tool Annotations support to MCP server (protocol 2025-03-26) · Issue #47 · adrian-d-hidalgo/nestjs-mcp-server · GitHub 8000
[go: up one dir, main page]

Skip to content
[Feature]: Add Tool Annotations support to MCP server (protocol 2025-03-26) #47
@adrian-d-hidalgo

Description

@adrian-d-hidalgo

✨ Feature Request

Prerequisites

  • I have searched the existing issues to make sure this feature hasn't been requested already
  • I have verified this is a feature request and not a question (for questions, use GitHub Discussions instead)

Package Version

0.2.0

NestJS Version

N/A

Problem Statement

The MCP protocol and the official TypeScript SDK (release 1.11.0, PR #309) now support Tool Annotations for describing tool behavior (e.g., read-only, destructive, etc.) as per protocol version 2025-03-26.
Currently, the NestJS MCP server does not expose a way to define or return tool annotations in its tool registration or discovery APIs, which limits compatibility and expressiveness for clients and tool consumers.

Proposed Solution

  • Add support for Tool Annotations in the NestJS MCP server, following the MCP spec and the implementation in the official TypeScript SDK.
  • Allow tool registration to accept annotation metadata (e.g., readOnly, destructive, etc.).
  • Ensure that the ListTools handler and tool discovery endpoints return the annotation data as part of the tool metadata.
  • Update documentation for the new annotation functionality.

Feature Type

  • Enhancement to existing functionality
  • Integration with other tools/libraries

Impact Level

High (would significantly improve my workflow)

Usage Example

// Example: Registering a tool with annotations
mcpServer.tool('deleteUser', {
  description: 'Deletes a user by ID',
  params: { userId: 'string' },
  annotations: { destructive: true }
});

When listing tools, the annotation should be present in the response:

{
  "name": "deleteUser",
  "description": "Deletes a user by ID",
  "params": { "userId": "string" },
  "annotations": { "destructive": true }
}

Alternatives Considered

  • Continue without annotation support (limits protocol compatibility and client expressiveness)
  • Custom metadata outside the MCP spec (not interoperable)

Contribution

  • I'm willing to submit a PR with this feature
  • I'd like guidance/mentoring to implement this feature

Additional Context

  • See typescript-sdk release 1.11.0 and PR #309 for reference implementation and spec details.

  • This feature will improve protocol compliance and enable richer tool discovery for clients.

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

enhancementNew feature or requestpriority: highUrgent or blocking other work

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0