Skip to content

Missing prompt-level _meta support in MCPServer.prompt() and Prompt model #3476

Open

Description

@m3chanic

Initial Checks

Release line

2.x (current stable)

Description

Description

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

from mcp.server.mcpserver import MCPServer

# ATTEMPTING TO USE METADATA ON PROMPTS
mcp = 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"})
def review_code(code: str) -> str:
    return f"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"}

Python & MCP Python SDK

- Python: 3.12+
- MCP Python SDK: 2.2.0

Activity

  1. Ben-Home commented on Sep 8, 2026

    @Ben-Home
  2. added 2 commits that reference this issue on Sep 8, 2026
    2ed6aec
    b960d19
  3. siddharthgaur1 commented on Sep 8, 2026

    @siddharthgaur1

    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.

  4. added
    v2Affects the v2 line (2.x on main)
    v1Affects the v1.x maintenance line
    on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv1Affects the v1.x maintenance linev2Affects the v2 line (2.x on main)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions