Skip to content

fix(mcp-common): tool schemas without not:{} for strict LLM validators#390

Open
advancedresearcharray wants to merge 1 commit into
cloudflare:mainfrom
advancedresearcharray:fix/strip-not-empty-tool-schemas-378
Open

fix(mcp-common): tool schemas without not:{} for strict LLM validators#390
advancedresearcharray wants to merge 1 commit into
cloudflare:mainfrom
advancedresearcharray:fix/strip-not-empty-tool-schemas-378

Conversation

@advancedresearcharray
Copy link
Copy Markdown

@advancedresearcharray advancedresearcharray commented Jun 4, 2026

Summary

  • Add stripNotEmptyJsonSchema to remove zod-to-json-schema { not: {} } optional arms
  • Patch MCP SDK toJsonSchemaCompat at CloudflareMCPServer init so all listed tools are sanitized
  • Use .optional() without redundant .nullable() on D1/Hyperdrive/pagination tool params

Fixes #378

Test plan

  • pnpm test in packages/mcp-common

Sanitize zod-to-json-schema optional arms, drop redundant nullable() on
optional tool params, and patch SDK schema conversion at server init.

Fixes cloudflare#378

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

workers-bindings MCP emits {"not":{}} in tool schemas, breaking strict LLM function-calling (Kimi, Gemini, OpenAI strict)

1 participant