Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[v1.x] Server-side outputSchema validation blocks tool error reporting (isError: true)

Offen
#2,429 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Ruhig
Tech-Stack
python

Rechercherichtung

Lies den Handler des call_tool-Dekorators in src/mcp/server/lowlevel/server.py ungefähr bei den Zeilen 560 und 575 und vergleiche anschließend die entsprechende Korrektur im TypeScript SDK in modelcontextprotocol/typescript-sdk#654 / PR #655. Bestätige, dass der Fehlerpfad die outputSchema-Validierung vermeidet und eine isError-Antwort für unstrukturierte Tool-Fehler beibehält, mit einer Regressionprüfung für das gemeldete Beispiel.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug fix proposed P2 ready for work
Initial Checks
Description

When a tool handler returns unstructured content for an error case, the low-level server's call_tool decorator validates the output against outputSchema before checking if the response is an error.

This prevents tools with outputSchema from reporting errors via isError: true, as the validation fails with "outputSchema defined but no structured output returned", replacing the original error message.

This was already fixed in the TypeScript SDK via modelcontextprotocol/typescript-sdk#654 / PR #655 (2025-06-24), but the equivalent fix has not been applied to the Python SDK v1.x branch.

The issue is in src/mcp/server/lowlevel/server.py, the call_tool decorator handler:

  1. Line ~560: outputSchema validation runs unconditionally — should skip when the result is an error
  2. Line ~575: isError=False is hardcoded — there is no path for the handler to signal an error through unstructured content while outputSchema is defined
Example Code
from mcp.server.lowlevel import Server
from mcp import types

server = Server("test")

@server.call_tool()
async def call_tool(name: str, arguments: dict):
    # Tool has outputSchema but needs to return an error
    # This gets blocked by outputSchema validation
    return [types.TextContent(type="text", text="Resource not found")]
Python & MCP Python SDK
- Python: 3.11 / 3.12
- MCP SDK: v1.26.0+ (v1.x branch)
Vorherrschende Sprache
Python
Sterne
24.3k
Forks
4k
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
30

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus modelcontextprotocol/python-sdk

Alle Issues in modelcontextprotocol/python-sdk

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

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