MCP plugin: expose tool annotations (hints like readOnlyHint) for generated and custom tools #16744
jhb-dev
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Plugin:
@payloadcms/plugin-mcpSummary
The MCP plugin auto-generates tools for collections (
find/create/update/delete) and globals (find/update), but it does not expose any way to set MCP tool annotations (a.k.a. "hints") on those tools. These annotations —readOnlyHint,destructiveHint,idempotentHint,openWorldHint, andtitle— are part of the MCP spec and are used by clients to communicate tool behavior to the user and the model.Notably, claude.ai uses these hints to group tools (e.g. separating read-only tools from tools that modify data), and to drive how/when a tool requires confirmation. Without them, every Payload-generated tool is treated identically, which makes the tool list harder to reason about and approve.
Background
Per the MCP spec, a tool definition may include an optional
annotationsobject:titlereadOnlyHintfalsedestructiveHinttrueidempotentHintfalseopenWorldHinttrueThese map very naturally onto the operations the plugin already generates:
find*→readOnlyHint: true,idempotentHint: truecreate*→readOnlyHint: falseupdate*→readOnlyHint: falsedelete*→readOnlyHint: false,destructiveHint: trueCurrent behavior
There is no configuration option to set annotations on the generated tools, and the plugin does not appear to set sensible defaults for them. The relevant config shapes (
collections[slug],globals[slug], andmcp.tools[]) exposeenabled,description,overrideResponse, etc., but nothing for annotations/hints.Desired behavior
Sensible defaults — the plugin should set the obviously-correct hints on the tools it generates (
find*read-only + idempotent,delete*destructive, etc.) so clients like claude.ai can group/handle them correctly out of the box.Custom tools — allow passing
annotationsthroughmcp.tools[]so custom tools can declare hints too:Why this matters
delete*tool flagged withdestructiveHint: truecan be gated behind stronger confirmation.annotationson tool registration — the plugin just needs to forward them.Beta Was this translation helpful? Give feedback.
All reactions