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.

Đánh giá

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

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.

Mô tả

v1 v2
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
Ngôn ngữ chính
Python
Star
24.3k
Fork
4k
Merge trung bình
1 ngày 19 phút
Pull request đã merge (30 ngày)
29

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.

Issue khác của modelcontextprotocol/python-sdk

Tất cả issue của modelcontextprotocol/python-sdk

Issue tương tự

Thêm issue về Python

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.