Preserve tool annotations and output schema through vmcp#4090
Merged
Conversation
MCP tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) were silently dropped during vmcp aggregation, and OutputSchema was never populated from backends. This blocks downstream authorization profiles that need annotation data. Add ToolAnnotations type to vmcp domain model and propagate both Annotations and OutputSchema through the full pipeline: backend query → tool adapter → conflict resolvers → merge → SDK adapter. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
yrobla
approved these changes
Mar 11, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4090 +/- ##
==========================================
+ Coverage 68.50% 68.52% +0.02%
==========================================
Files 447 447
Lines 45663 45746 +83
==========================================
+ Hits 31281 31349 +68
- Misses 11964 11973 +9
- Partials 2418 2424 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
readOnlyHint,destructiveHint,idempotentHint,openWorldHint,Title) were silently dropped during vmcp aggregation, blocking downstream authorization profiles. This adds theToolAnnotationsvmcp domain type and propagates it through the full pipeline.OutputSchemaexisted onvmcp.Toolbut was never populated from backend MCP servers. This populates it using the same JSON round-trip pattern asInputSchema.Type of change
Test plan
task test)task lint-fix)22 new test cases across 4 test files:
pkg/vmcp/conversion/content_test.go— conversion functions (15 cases including round-trip)pkg/vmcp/aggregator/tool_adapter_annotations_test.go— preservation through overrides (3 cases)pkg/vmcp/server/adapter/capability_adapter_annotations_test.go— SDK output (4 cases)Changes
pkg/vmcp/types.goToolAnnotationsstruct andAnnotationsfield toToolpkg/vmcp/conversion/content.goConvertToolAnnotations,ConvertToolOutputSchema,ToMCPToolAnnotationspkg/vmcp/client/client.goAnnotations+OutputSchemafrom backendpkg/vmcp/session/internal/backend/mcp_session.gopkg/vmcp/aggregator/aggregator.goResolvedToolpkg/vmcp/aggregator/prefix_resolver.gopkg/vmcp/aggregator/priority_resolver.gopkg/vmcp/aggregator/manual_resolver.gopkg/vmcp/aggregator/default_aggregator.gopkg/vmcp/aggregator/tool_adapter.gopkg/vmcp/server/adapter/capability_adapter.goAnnotationsandRawOutputSchemato SDK typesDoes this introduce a user-facing change?
No direct user-facing change. Backend MCP tool annotations and output schemas are now preserved through vmcp aggregation instead of being silently dropped. This enables downstream consumers (like authorization profiles) to use these fields.
Special notes for reviewers
vmcp.ToolAnnotationsis a vmcp-owned type (notmcp.ToolAnnotationdirectly) to maintain the Anti-Corruption Layer — mcp-go is only used at ingestion and SDK adapter boundaries.Icons,Execution, ResourceAnnotations, and PromptIconsare deferred to a follow-up PR per the split strategy.ConvertToolOutputSchemanil check: Usesschema.Type == ""rather than byte-length check because a zero-valuedToolOutputSchemamarshals to{"type":"","properties":{},"required":[]}(non-empty JSON but semantically empty).Generated with Claude Code