#18286·payload

plugin-mcp: auto-generated create tool for upload-enabled collections has no way to attach file content

Author: JVPConsultingCreated Sep 24, 2026Updated Sep 29, 2026
LabelsBug

Summary For any collection with upload: true, plugin-mcp's auto-generated create<Collection> tool can never succeed — it has no parameter for file content, so every call fails with MissingFile: No files were uploaded.

Reproduction

  1. Enable the plugin on an upload collection (e.g. Payload's own Media example) with create capability on.
  2. Call the generated tool, e.g. createMedia, with the collection's writable fields (alt, etc.).
  3. Call fails: Error creating resource in collection "media": MissingFile: ...

Root cause (traced in the installed @payloadcms/[email protected] / [email protected]):

  • The MCP endpoint hands the raw request to a generic JSON-RPC handler (createRequestFromPayloadRequest → mcp-handler) — no multipart parsing anywhere in that path.
  • The tool's input schema is generated purely from the collection's field schema (convertCollectionSchemaToZod), with no special-casing for upload collections — no file parameter is ever generated.
  • The generated handler (mcp/tools/resource/create.js) forwards only the JSON fields to payload.create({ data, ... }), never setting file.
  • Payload's own generateFileData() checkpoint then finds neither req.file nor an explicit file argument and throws.

This is independent of storage backend — local disk or S3, the create operation requires an attached file before it decides where to store it. Confirmed same failure against S3-backed storage.

Suggested fix direction, and offer to contribute: for collections with upload: true, the generated tool could accept a base64-encoded file argument and pass it through as file: { data: Buffer.from(base64, 'base64'), mimetype, name, size } on the Local API create() call (supported since #708). I've verified this works end-to-end (base64 round-trip + real S3 upload) as a standalone patch — happy to open a PR if that direction is welcome, or if there's a reason upload collections were intentionally left out, that'd be useful to know too.

Versions: @payloadcms/[email protected], [email protected], Postgres adapter, @payloadcms/storage-s3.