Skip to content

fix(vtex): remove outputSchema from tools to prevent MCP validation errors#247

Merged
tlgimenes merged 2 commits intomainfrom
fix/vtex-execute-unhandled-exception
Feb 24, 2026
Merged

fix(vtex): remove outputSchema from tools to prevent MCP validation errors#247
tlgimenes merged 2 commits intomainfrom
fix/vtex-execute-unhandled-exception

Conversation

@tlgimenes
Copy link
Contributor

@tlgimenes tlgimenes commented Feb 24, 2026

Summary

  • Remove outputSchema and its associated Zod schema definition from search-collections custom tool — tools that proxy arbitrary API responses should not advertise a structured output contract
  • Bump @decocms/runtime to 1.2.10, which fixes the runtime to pass undefined as outputSchema to server.registerTool() when no schema is defined (previously fell back to an empty z.object({}), causing all tools to unnecessarily advertise structured output validation)

Root Cause

The MCP client validates structuredContent against the tool's outputSchema. Two problems were present:

  1. Custom tools with an explicit z.object({...}) outputSchema caused -32602 errors when the VTEX API returned fields not in the schema, because zod-to-json-schema adds additionalProperties: false by default.
  2. The runtime always registered every tool with an outputSchema (falling back to an empty z.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

  1. Configure a VTEX MCP connection with valid credentials
  2. Call the VTEX_SEARCH_COLLECTIONS tool with a search term
  3. Confirm results are returned without MCP error -32602
  4. Call any other VTEX tool and confirm no structured content validation errors

Screenshots

N/A

Migration Notes

N/A

…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>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@github-actions
Copy link

github-actions bot commented Feb 24, 2026

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 vtex

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: 51c88fa

…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>
@tlgimenes tlgimenes changed the title fix(vtex): allow additional properties in search-collections output schema fix(vtex): remove outputSchema from tools to prevent MCP validation errors Feb 24, 2026
@tlgimenes tlgimenes merged commit 89b3764 into main Feb 24, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants