MCP 2.x Structured Output Requires Typed Return Annotations to Activate
A developer porting an eight-tool MCP server to the 2.x SDK found that tools with bare dict return annotations register and run without errors. Testing revealed the results come back only as JSON text in a TextContent block, leaving structured_content empty. Replacing the annotation with a TypedDict produced a published output schema and populated structured_content, with the function body unchanged. The difference lies in whether the SDK can derive a JSON Schema from the return type, and bare dict is silently excluded without any warning.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in