claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Support MCP annotations on Resources and Content blocks

Open bhosmer-ant opened this issue 1 week ago • 0 comments

Summary

Claude Code currently uses ToolAnnotations from MCP tools (e.g., readOnlyHint, destructiveHint, openWorldHint, title), but does not process the separate Annotations schema that applies to Resources, Resource Templates, and Content blocks.

MCP Annotations Schema

The MCP SDK defines an Annotations type (distinct from ToolAnnotations) with:

{
  audience?: ("user" | "assistant")[]  // Who content is intended for
  priority?: number                     // Importance/priority  
  lastModified?: ISODateTime            // When last modified
}

This applies to:

  • Resources (from resources/list)
  • Resource Templates
  • Content blocks returned from tools (TextContent, ImageContent, etc.)

Current Behavior

  • Resources: fetchResourcesForClient spreads resources with a server name but ignores annotations
  • ListMcpResourcesTool: Output schema excludes annotations entirely
  • Content blocks: transformResultContent processes content types but never checks annotations

Suggested Improvements

  1. audience filtering: Content marked audience: ["user"] could be shown to the user but excluded from the model context. Content marked audience: ["assistant"] could be included in model context but hidden from user display.

  2. priority sorting: Resources or content could be sorted/prioritized based on this hint.

  3. lastModified display: Could be shown in resource listings or used for cache invalidation.

References

  • MCP spec: https://modelcontextprotocol.io/specification/2025-03-26/server/utilities/annotations
  • Current tool annotations usage: src/services/mcp/client.ts:1307-1318

bhosmer-ant avatar Jan 14 '26 00:01 bhosmer-ant