modelcontextprotocol / modelcontextprotocol/python-sdk

Implement consistent structuredContent handling per specification clarification

Offen
#1,332 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug enhancement needs decision P3 pending SEP approval
Vorherrschende Sprache
Python
Sterne
24.3k
Forks
4k
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
31

Beschreibung

Summary

Following the specification issue modelcontextprotocol/specification#1411, the Python SDK needs to ensure consistent handling of structuredContent vs content fields in tool responses.

Problem

Currently there's inconsistency across MCP implementations:

  • Some clients use structuredContent when available (e.g., Cursor)
  • Others ignore it entirely
  • This leads to different behavior with the same servers

Current SDK Behavior

The Python SDK needs to be reviewed to ensure it properly handles the relationship between structuredContent and content fields.

Required Changes

Once modelcontextprotocol/specification#1411 is resolved, update the SDK to:

  1. Implement the specified client behavior for structuredContent
  2. Ensure proper fallback to content when needed
  3. Validate that servers populate both fields consistently
  4. Add tests to verify the correct behavior
  5. Ensure consistency with the TypeScript SDK implementation

References

cc: @dsp-ant

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Lesen Sie zuerst den Spezifikations-Issue modelcontextprotocol/specification#1411 und den verknüpften TypeScript-SDK-Issue; sie definieren das Verhalten, an das sich dieses Python SDK halten muss. Suchen Sie anschließend die Verarbeitung von Antworten des Python-Clients und -Servers und fügen Sie Tests für das präzisierte Verhalten von structuredContent hinzu. Als abgeschlossen gilt die Implementierung des angegebenen Fallbacks, die Validierung konsistenter Serverfelder und die Übereinstimmung mit dem TypeScript SDK.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, typescript
Bereich
api, backend-api-design
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.