modelcontextprotocol / modelcontextprotocol/python-sdk

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

Open
#3,476 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v1 v2
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 1h
Merged PRs (30d)
31

Description

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

Contributor guide

Open the contributing guide

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.

Research direction

Start at MCPServer.prompt and the high-level Prompt model, then trace how list_prompts serializes prompt fields. Confirm how @mcp.tool accepts meta and how its list operation emits _meta; done means @mcp.prompt accepts the metadata without a TypeError and list_prompts returns it as _meta.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.