Support MCP annotations on Resources and Content blocks
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:
fetchResourcesForClientspreads resources with aservername but ignores annotations - ListMcpResourcesTool: Output schema excludes annotations entirely
-
Content blocks:
transformResultContentprocesses content types but never checks annotations
Suggested Improvements
-
audiencefiltering: Content markedaudience: ["user"]could be shown to the user but excluded from the model context. Content markedaudience: ["assistant"]could be included in model context but hidden from user display. -
prioritysorting: Resources or content could be sorted/prioritized based on this hint. -
lastModifieddisplay: 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