You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing prompt-level _meta support in MCPServer.prompt() and Prompt model #3476
The 2026-07-28 specification defines the optional _meta field on the Prompt schema. While other decorators like @mcp.tool support meta and pass it down as _meta on serialization (e.g., in MCPServer.list_tools). The @mcp.prompt decorator and the high-level Prompt classes are missing support for meta.
Expected Behavior
Including meta on @mcp.prompt does not incur a type error and returns _meta for the prompt on list_prompts.
Example Code
frommcp.server.mcpserverimportMCPServer# ATTEMPTING TO USE METADATA ON PROMPTSmcp=MCPServer("MetaTestServer")
# This currently raises a TypeError because meta is not a parameter in @mcp.prompt@mcp.prompt(name="code_review",title="Code Review",description="Review code with specific metadata rules",meta={"strictness": "high"})defreview_code(code: str) ->str:
returnf"Review this: {code}"# 2. EXPECTED BEHAVIOR# If the decorator parameter was supported, list_prompts should return prompt with _meta:# listed_prompts = await mcp.list_prompts()# assert listed_prompts[0].meta == {"audience": "strictness": "high"}
I've opened #3479 for this. It was auto-closed because I'm not assigned here — the bot says it reopens on its own if a maintainer assigns me, so this is a request for that rather than anything needing action on the PR.
The wire type already supports it: on main, Prompt(name="x", _meta={"a": 1}).model_dump(by_alias=True) gives {'name': 'x', '_meta': {'a': 1}}. Only the high-level layer was missing it, so the change mirrors what @mcp.tool and @mcp.resource already do — a meta field on the high-level Prompt, a meta argument on Prompt.from_function and the decorator, and _meta=prompt.meta in list_prompts next to the existing _meta=info.meta in list_tools. Three source lines added, one changed.
Three tests next to the existing TestServerResourceMetadata, including your example verbatim; two of them fail on main with the TypeError from the issue. tests/server/mcpserver/: 633 passed, 1 skipped. ruff clean, and pyright on the changed files shows only the pre-existing asynccontextmanager deprecation at server.py:149.
I left get_prompt alone deliberately — it doesn't carry meta into the protocol response, mirroring read_resource, and this issue asks only about list_prompts. Happy to extend it if you'd rather have both.
Written with AI assistance (Claude Code); I reproduced the TypeError on main @ 9972c21 and read the tool/resource meta paths before mirroring them.
Activity
Ben-Home commentedon Sep 8, 2026
feat(mcpserver): add prompt-level meta support to MCPServer.prompt an…
feat(mcpserver): add prompt-level meta support to MCPServer.prompt an…
siddharthgaur1 commentedon Sep 8, 2026
I've opened #3479 for this. It was auto-closed because I'm not assigned here — the bot says it reopens on its own if a maintainer assigns me, so this is a request for that rather than anything needing action on the PR.
The wire type already supports it: on
main,Prompt(name="x", _meta={"a": 1}).model_dump(by_alias=True)gives{'name': 'x', '_meta': {'a': 1}}. Only the high-level layer was missing it, so the change mirrors what@mcp.tooland@mcp.resourcealready do — ametafield on the high-levelPrompt, ametaargument onPrompt.from_functionand the decorator, and_meta=prompt.metainlist_promptsnext to the existing_meta=info.metainlist_tools. Three source lines added, one changed.Three tests next to the existing
TestServerResourceMetadata, including your example verbatim; two of them fail onmainwith theTypeErrorfrom the issue.tests/server/mcpserver/: 633 passed, 1 skipped.ruffclean, andpyrighton the changed files shows only the pre-existingasynccontextmanagerdeprecation atserver.py:149.I left
get_promptalone deliberately — it doesn't carry meta into the protocol response, mirroringread_resource, and this issue asks only aboutlist_prompts. Happy to extend it if you'd rather have both.Written with AI assistance (Claude Code); I reproduced the
TypeErroronmain@9972c21and read the tool/resource meta paths before mirroring them.