Composite Tools Support Structured Content #3009
Draft
+473 −7
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.
Stacked on #3006 because of when I discovered this gap.
Summary
StructuredContentbefore falling back toContentarray processing (legacy behavior)structuredContentwould be verbose/clunky. It also does not match much of the existing documentation.Fixes #2994
Changes
Core Fix (
pkg/vmcp/client/client.go):result.StructuredContentbefore processingresult.ContentarrayStructuredContentis an object (map[string]any), use it directly as step outputContentprocessing for text/image contentTest Helpers (
test/integration/vmcp/helpers/backend.go):StructuredHandlerfield toBackendToolfor structured content responsesNewBackendToolWithStructuredResponse()constructorCreateBackendServerto usemcp.NewToolResultStructuredOnly()when appropriateIntegration Tests (
test/integration/vmcp/vmcp_integration_test.go):TestVMCPServer_StructuredContent: Tests nested field access via{{.steps.X.output.field.nested}}TestVMCPServer_DefaultResults_NestedStructure: Tests nested defaultResults fallbackDocumentation:
docs/operator/virtualmcpcompositetooldefinition-guide.md: Added "Step Output Format" and "Numeric Values in Templates" sectionsdocs/operator/advanced-workflow-patterns.md: Added "Step Output Format" and "Numeric Comparisons" sections