Support explicit elicitation capabilities and safe per-request narrowing
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả 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
Read the capability construction and modern request stamping in src/mcp/client/session.py, identified in the issue references, and compare them with the reproduction in the issue body. First inspect how sampling_capabilities is configured and how concurrent requests carry client capabilities. Done means supported elicitation modes can be declared explicitly and modern requests can safely narrow capabilities without widening them or changing shared state; the issue leaves the API design open.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Clients should advertise only the elicitation modes they can actually fulfill. While developing a stdio-to-Streamable-HTTP MCP bridge, we found two limitations in the Python SDK:
- Installing an elicitation callback advertises both
formandurl, even if the implementation supports forms only. - On 2026-07-28 connections, the SDK replaces request-local
clientCapabilitieswith the configured client capabilities. A caller cannot narrow them for an individual request.
We left elicitation relay disabled rather than advertise unsupported interaction modes.
This also affects potential use cases beyond transport bridges: terminal and embedded clients that implement forms but not URL interactions; proxies and gateways serving hosts with different capabilities or interaction policies; and agents that need to disable user interaction for unattended requests. The common requirement is accurate capability declaration, not a bridge-specific API.
Reproduction
The original SDK 2.2.0 findings have now been reproduced on v2.3.0 and main at 77001c96.
Environment: CPython 3.13.18; isolated environments with mcp/mcp-types 2.3.0 (HTTPX2 2.17.0), and local builds from the cited main commit. The modern results agree across real loopback Streamable HTTP and in-process tests. Legacy behavior was also tested.
This minimal example was run verbatim on both versions:
import anyio
from mcp import types
from mcp.client import Client
from mcp.server.lowlevel import Server
from mcp_types import CLIENT_CAPABILITIES_META_KEY
async def elicit(ctx, params):
return types.ElicitResult(action="decline")
async def list_tools(ctx, params):
return types.ListToolsResult(tools=[
types.Tool(name="inspect", input_schema={"type": "object"})
])
async def inspect(ctx, params):
caps = ctx.session.client_capabilities
return types.CallToolResult(
content=[], structured_content=caps.model_dump(exclude_none=True)
)
async def main():
server = Server("fixture", on_list_tools=list_tools, on_call_tool=inspect)
async with Client(server, mode="auto", elicitation_callback=elicit) as client:
result = await client.call_tool(
"inspect", {}, meta={CLIENT_CAPABILITIES_META_KEY: {"elicitation": {"form": {}}}}
)
print(result.structured_content["elicitation"])
anyio.run(main)
Actual output: {'form': {}, 'url': {}}.
Additional runtime cases on both versions:
| Scenario | Observed elicitation capability | Desired capability |
|---|---|---|
| No callback (control) | Absent | Absent |
| Form-only implementation with callback | Form + URL | Form only |
| Modern request narrowed to form | Form + URL | Form only |
| Modern request narrowed to no interaction | Form + URL | Absent |
| Concurrent modern requests A (form only) and B (none) | Both Form + URL | A: Form only; B: Absent |
Server-side control: hand-built 2026-07-28 requests to the same server preserve form-only, form+URL and absent elicitation declarations. The observed limitation is in the SDK client, not the server's handling of these request capabilities. Legacy per-connection capability behavior is expected and is not a defect.
Alternative: separate client instances can distinguish no interaction (no callback) from full elicitation (callback), but still cannot express form-only support. Separate instances also require routing and additional connection/discovery setup.
Possible API direction (open to maintainer preference)
- An optional
elicitation_capabilitiesparameter, analogous tosampling_capabilities, to express supported modes explicitly. Preserve existing defaults. - For modern requests, a supported way to narrow configured capabilities per request. It should never permit widening beyond what the client can fulfill, must not mutate shared client state, and should isolate concurrent requests. Leave legacy negotiation unchanged.
The two limitations are reproduced; the proposed API changes are design requests, not a prescribed implementation. I would be interested in helping with a focused fix if this direction is appropriate.
References
- Capability construction in v2.3.0
- Modern request stamping in v2.3.0
- #2965 concerns server-side capability checking; this request concerns client-side declaration and request scope.
AI disclosure: AI coding assistants helped investigate, run the reproductions, compare SDK source, and prepare this issue. No implementation PR has been opened.
- Ngôn ngữ chính
- Python
- Star
- 25k
- Fork
- 4.2k
- Merge trung bình
- 10 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của modelcontextprotocol/python-sdk
-
v2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
modelcontextprotocol/python-sdk#3978 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Client serves cached tools after its context exits with an exceptionCó thể đã có người làm @jonxsong đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
modelcontextprotocol/python-sdk#3968 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
modelcontextprotocol/python-sdk#3957 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
v2
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
modelcontextprotocol/python-sdk#3934 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug v1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
modelcontextprotocol/python-sdk#3929 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của modelcontextprotocol/python-sdk
Issue tương tự
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwiseCó thể đã có người làm @abdulwaarith0 đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
MakazhanAlpamys/Soup#3690 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug data-types native-format
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobĐang mởaccepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
future-agi/future-agi#6392 ·
Maintainer thường phản hồi trong vòng 1 ngày