[Bug] check_capability does not validate elicitation sub-capabilities (form/url)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 82/100
Rechercherichtung
Beginne in src/mcp/server/connection.py bei den Zeilen 340–341 und vergleiche die Elicitation-Behandlung mit den bestehenden Sampling-Prüfungen. Reproduziere den im Issue beschriebenen Fall mit URL-only gegenüber form-only capabilities und überprüfe anschließend, dass übereinstimmende und nicht übereinstimmende form/url capabilities in der relevanten Testsuite die erwarteten Ergebnisse zurückgeben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Summary
Connection.check_capability() returns True when a client has URL-mode elicitation but the caller checks for form-mode elicitation — the sub-capability (ElicitationCapability.form / .url) is never inspected.
Root cause
In src/mcp/server/connection.py:340-341:
if capability.elicitation is not None and have.elicitation is None:
return False
This only returns False when the client has no elicitation at all. It does not check individual sub-capabilities (form / url). Compare with sampling, which correctly checks sub-capabilities:
if capability.sampling is not None:
if have.sampling is None:
return False
if capability.sampling.context is not None and have.sampling.context is None:
return False
if capability.sampling.tools is not None and have.sampling.tools is None:
return False
Reproduction
# Client supports URL elicitation only
have = ClientCapabilities(elicitation=ElicitationCapability(url=UrlElicitationCapability()))
# Check for form elicitation — should be False (client does not have form)
want = ClientCapabilities(elicitation=ElicitationCapability(form=FormElicitationCapability()))
Connection.from_envelope("2025-11-25", client_info, have).check_capability(want) # Returns True (BUG)
Impact
check_capabilityis public API (viaServerSession.check_client_capability)- Currently no production callers use elicitation sub-capability checks — low immediate impact
- But once someone relies on it (e.g., checking if the client supports form elicitation before calling
elicit_form), it will return wrong results
Additional gaps (lower priority)
extensions—ClientCapabilities.extensionsis not checked at alltasks—ClientCapabilities.tasksand sub-capabilities entirely unhandled
Proposed fix
Add form / url sub-capability checks, matching the sampling pattern:
if capability.elicitation is not None:
if have.elicitation is None:
return False
if capability.elicitation.form is not None and have.elicitation.form is None:
return False
if capability.elicitation.url is not None and have.elicitation.url is None:
return False
AI assistance: Bug discovered and analyzed with AI assistance (opencode).
- Vorherrschende Sprache
- Python
- Sterne
- 24.3k
- Forks
- 4k
- Ø Merge
- 1 T. 19 Min.
- Gemergte PRs (30 T.)
- 29
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/python-sdk
-
v1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
modelcontextprotocol/python-sdk#3546 · 5 Kommentare ·
-
v1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
modelcontextprotocol/python-sdk#3545 · 1 Kommentar ·
-
v1 v2
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 91/100
modelcontextprotocol/python-sdk#3508 · 2 Kommentare ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
modelcontextprotocol/python-sdk#3504 ·
-
v1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
modelcontextprotocol/python-sdk#3492 · 1 Kommentar ·
Alle Issues in modelcontextprotocol/python-sdk
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
use-agent-os/agent-os#3314 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
BasedHardware/omi#15662 · 1 Kommentar ·
-
documentation help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 90/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
AiursoftWeb/AnduinOS-2#19 ·