What this thread does
Diagnostic: Tool <name> has an output schema but did not return structured content is raised by the MCP client (Python and TypeScript SDK source) when a tool lists an outputSchema but its result has no structuredContent. Fix the server, or drop the schema: in the Python SDK add structured_output=False to the tool decorator. If the result is a plain error, set isError (is_error in Python): both the Python client (session.py) and the TypeScript client skip the output-schema checks for error results.
Checked 2026-10-30. Separate case, covered below: typing.Dict[str, X] returns wrapped in {"result": ...}.
Not for: transport errors like 400 or 406, see mcp-streamable-http-400-missing-session-id-406-not-acceptable; a server that never connects, see claude-code-mcp-server-failed-to-connect-status-checklist.
Opt out and validation (Python SDK docs)
from mcp.server import MCPServer
mcp = MCPServer("Weather")
@mcp.tool(structured_output=False)
def weather_report(city: str) -> str:
...
Per the structured output page, with this flag there is no output schema, no wrapping and no validation; structured_content is None and content carries the text. structured_output=True forces structured output and raises at import time if the return type cannot be serialized.
- Opted out by default: content blocks (alone, in a list or union), a bare
listortuple, and a class without type hints (the model then gets itsrepr). - Wrapped in
{"result": ...}per the page: scalars,list[...],tuple[...], sets and unions, and adictwith non-strkeys.dict[str, ...],Dict[str, ...]and baredictare documented as unwrapped objects; that matches the main branch after the fixes below, not the released v2.3.0 behavior reported in the issues. - A return value that does not match the schema fails the call:
is_error=True, text "Error executing tool get_weather", and a PydanticValidationErrorin the server log (for example a missinghumidityfield). - Client side: the Python client raises
RuntimeErrorwith the message above, andInvalid structured content returned by tool <name>when the content does not match (session.py). The TypeScript client uses the same first message, plusStructured content does not match the tool's output schema(client.ts).
The typing.Dict wrapping bug
Do first: annotate tool returns as dict[str, Any] (builtin) until a release with the fixes ships; the issues show that form behaves as intended. Symptom: -> typing.Dict[str, Any] gives outputSchema with a result property and structuredContent {"result": {...}}, while -> dict[str, Any] gives the object itself. A bare -> dict (also list, tuple) got no outputSchema and no structuredContent, and with structured_output=True raised InvalidSignature ... return type <class 'dict'> is not serializable for structured output. Cause (from the issues): in _create_output_model the generic branch used isinstance(type_expr, GenericAlias) from types; typing.Dict[str, X] is a typing._GenericAlias, so it fell through to the wrap-everything case. Bare containers went to the "other class types" case where get_type_hints(dict) is empty. The #3745 reporter notes ruff UP006 rewrites Dict to dict and silently changed one tool's output, so a client with a cached schema rejected results. Fixes (read 2026-10-30): PR #3756 treats typing.Dict[str, X] like dict[str, X] (merged 2026-10-24, closes #3745). PR #3758 gives bare dict the dict[str, Any] behavior and wraps bare set/frozenset; per its description a bare list/tuple deliberately stays unstructured (and is wrapped with structured_output=True). Closes #3725. The PR descriptions flag the change: tools on typing.Dict[str, X] stop wrapping in {"result": ...}, and bare -> dict tools start publishing an outputSchema. Release: v2.3.0 (2026-10-02) predates both merges, so the fixes are on main only. Still open: #3771 (2026-10-27) reports unsubscripted typing.Dict still wrapped and typing.List/typing.Tuple bypassing the opt-out; a reporter says they have a branch, no maintainer reply seen. Members: #3745 (benjamin-di, closed), #3725 (g-s-jithesh, closed), #3771 (chauvuusvn, open). Checked 2026-10-30.
Started from a post by @benjamin-di, packaged by the editor. Original post