Skip to content

test: align MCP plugin codegen eval with plugin-mcp tools config API - #16896

Merged
GermanJablo merged 2 commits into
mainfrom
fix/eval-mcp-collection-tools-shape
Jun 8, 2026
Merged

GermanJablo merged 2 commits into
mainfrom
fix/eval-mcp-collection-tools-shape

Conversation

@GermanJablo

Copy link
Copy Markdown
Contributor

The plugins/official/codegen/mcp eval expected the per-collection shape { enabled: { find, create } }, but @payloadcms/plugin-mcp configures per-collection tools via { tools: { find, create } }. The enabled key was removed in the plugin refactor (#16726), so the rubric was penalizing output that correctly follows the current API. This updates the expected shape to tools.

Re-opened directly on the repo (previous PR #16895 was closed when the source fork was deleted).

Open question

How should evals (and skills) be maintained across versions, given v4 is still in beta while most users run 3.x? Some options:

  1. Track latest only (v4, even in beta). Single source of truth and GA-ready, but most users are on 3.x today, so answers/evals serve a version almost nobody runs in prod yet.
  2. Track 3.x now, switch to v4 at GA. Matches what most users run today, but doesn't help v4 early adopters and needs a coordinated switch at GA.
  3. Version-aware breaking-changes layer. Feed a breaking-changes registry from the official v3 -> v4 migration guide and per-release notes (rather than maintaining it by hand); on each question the agent checks it and, if an API changed, warns that earlier versions may differ.

My preference is option 3, but that can be implemented in a later PR. This is necessary to unlock the CI of the Payload Agent that runs these evaluations.

The plugins/official/codegen/mcp eval expected the per-collection config
shape `{ enabled: { find, create } }`, but `@payloadcms/plugin-mcp` exposes
per-collection tools via `{ tools: { find, create } }` (see
`MCPPluginCollectionConfig` in packages/plugin-mcp/src/types.ts and the
examples in docs/plugins/mcp.mdx). There is no `enabled` key, so the rubric
was penalizing output that correctly follows the documented API. Update the
expected shape to `tools`.
@GermanJablo
GermanJablo requested a review from denolfe June 5, 2026 10:42
@GermanJablo
GermanJablo enabled auto-merge (squash) June 5, 2026 10:45
@github-actions

github-actions Bot commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

📦 esbuild Bundle Analysis for payload

This analysis was generated by esbuild-bundle-analyzer. 🤖
This PR introduced no changes to the esbuild bundle! 🙌

@GermanJablo
GermanJablo merged commit 00aaeb5 into main Jun 8, 2026
167 of 169 checks passed
@GermanJablo
GermanJablo deleted the fix/eval-mcp-collection-tools-shape branch June 8, 2026 14:41
GermanJablo added a commit that referenced this pull request Jun 29, 2026
## What

Updates the `plugins/official/codegen/mcp` eval case so its expected
shape matches the current `@payloadcms/plugin-mcp` API.

## Why

This is a follow-up to the same kind of alignment done in #16896, but
for
a newer breaking change.

- In #16896 the eval was updated from `{ enabled: { find, create } }` to
  `{ tools: { find, create } }` after the plugin refactor.
- #16962 (`feat(plugin-mcp)!: use generic CRUD tools`) then changed the
  model again: collections are now **opt-out**. Built-in CRUD tools
(`find`, `create`, `update`, `delete`, `getCollectionSchema`) are
enabled
by default and accept `false` (to disable) or an override object,
**not**
  `true`.

As a result, the previous expected output (`tools: { find: true, create:
true }`)
is no longer valid v4, and the rubric was penalizing the agent for
generating correct, current code.

## Change

Rewrites the single MCP case to the opt-out model, mirroring the
canonical
example in `docs/plugins/mcp.mdx` (configure a description and disable a
built-in tool with `delete: false`):

```ts
mcpPlugin({
  collections: {
    posts: {
      tools: { delete: false },
      description: "Blog posts for content creation",
    },
  },
})
```

The `input` prompt is updated accordingly, since "enable find and
create"
no longer maps to a positive config under the opt-out model.

## Context

- #16896 - previous eval alignment (`enabled` -> `tools`)
- #16962 - breaking change this PR adapts to (generic CRUD tools /
opt-out)

Co-authored-by: German Jablonski <[email protected]>
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.

2 participants