Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#18,286 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
nodejs, typescript
Domain
api, backend

Research direction

Start by tracing createRequestFromPayloadRequest through mcp-handler, then inspect convertCollectionSchemaToZod and mcp/tools/resource/create.js for how upload collection schemas and create arguments are handled. Done means an upload-enabled collection's generated create tool can receive file content and complete creation, including with the storage configurations described in the issue.

Written by the indexing model from the issue text.

Description

Bug

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.

Dominant language
TypeScript
Stars
45.5k
Forks
4.3k
Avg merge
1d 21h
Merged PRs (30d)
302

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.