fix(vtex): remove outputSchema from tools to prevent MCP validation errors#247
Merged
fix(vtex): remove outputSchema from tools to prevent MCP validation errors#247
Conversation
…chema Add .passthrough() to all z.object() schemas in collectionListOutputSchema so zod-to-json-schema does not emit additionalProperties: false. This prevents MCP error -32602 when the VTEX API returns fields not declared in the schema. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
viniciusventura29
approved these changes
Feb 24, 2026
🚀 Preview Deployments Ready!Your changes have been deployed to preview environments: 📦
|
…1.2.10 - Remove outputSchema and its Zod schema definition from search-collections, letting the MCP SDK pass undefined for tools without a structured output contract instead of the empty-object fallback - Bump @decocms/runtime to 1.2.10, which fixes the runtime to pass undefined outputSchema to server.registerTool() when no outputSchema is defined, avoiding unnecessary structured output validation for all tools Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
outputSchemaand its associated Zod schema definition fromsearch-collectionscustom tool — tools that proxy arbitrary API responses should not advertise a structured output contract@decocms/runtimeto1.2.10, which fixes the runtime to passundefinedasoutputSchematoserver.registerTool()when no schema is defined (previously fell back to an emptyz.object({}), causing all tools to unnecessarily advertise structured output validation)Root Cause
The MCP client validates
structuredContentagainst the tool'soutputSchema. Two problems were present:z.object({...})outputSchema caused-32602errors when the VTEX API returned fields not in the schema, becausezod-to-json-schemaaddsadditionalProperties: falseby default.outputSchema(falling back to an emptyz.object({})shape when none was defined), making the MCP client treat all tools as having structured output contracts even when they don't.How to Test
VTEX_SEARCH_COLLECTIONStool with a search term-32602Screenshots
N/A
Migration Notes
N/A