modelcontextprotocol / modelcontextprotocol/python-sdk
Missing prompt-level _meta support in MCPServer.prompt() and Prompt model
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 24.3k
- Forks
- 4k
- Ø Merge
- 1 T. 1 Std.
- Gemergte PRs (30 T.)
- 31
Beschreibung
Initial Checks
- I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1)
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne bei MCPServer.prompt und dem übergeordneten Prompt-Modell und verfolge anschließend, wie list_prompts Prompt-Felder serialisiert. Bestätige, wie @mcp.tool meta akzeptiert und wie seine list-Operation _meta ausgibt; abgeschlossen ist es, wenn @mcp.prompt die Metadaten ohne einen TypeError akzeptiert und list_prompts sie als _meta zurückgibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api, backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 68/100