Skip to content

fix(plugin-mcp): omit body on GET/HEAD and fix schema fallback partial()#17132

Open
SakshixSingh wants to merge 1 commit into
payloadcms:3.xfrom
SakshixSingh:fix/plugin-mcp-get-body-and-schema-fallback
Open

fix(plugin-mcp): omit body on GET/HEAD and fix schema fallback partial()#17132
SakshixSingh wants to merge 1 commit into
payloadcms:3.xfrom
SakshixSingh:fix/plugin-mcp-get-body-and-schema-fallback

Conversation

@SakshixSingh

Copy link
Copy Markdown
Contributor

fixes #17125

What?

Fixes two MCP plugin bugs:

  1. GET/HEAD requests no longer pass a body when constructing the Request object
  2. Schema conversion fallback returns z.object({}) instead of z.record(z.any()) so .partial() works in update tools

Why?

  • MCP uses GET for the SSE stream; passing a body causes Request with GET/HEAD method cannot have body (500)
  • When jsonSchemaToZod fails on complex schemas, the fallback z.record() crashes update tools that call .partial()

How?

  • createRequest.ts: conditionally omit body/duplex for GET and HEAD
  • convertCollectionSchemaToZod.ts: use z.object({}) as permissive fallback
  • Added unit tests for both fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant