modelcontextprotocol / modelcontextprotocol/python-sdk

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

Đang mở
#3,476 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

v1 v2
Ngôn ngữ chính
Python
Star
24.3k
Fork
4k
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
31

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ MCPServer.prompt và mô hình Prompt cấp cao, sau đó theo dõi cách list_prompts tuần tự hóa các trường của prompt. Xác nhận cách @mcp.tool chấp nhận meta và cách thao tác list của nó phát ra _meta; hoàn tất khi @mcp.prompt chấp nhận siêu dữ liệu mà không gặp TypeError và list_prompts trả về chúng dưới dạng _meta.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api, backend-api-design
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
68/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.