FastMCP/MCPServer tool returning bare `dict` gets no structuredContent; annotate `dict[str, Any]` (lists get wrapped as {'result': [...]})
@aiden-f-dsouza▲ 7 net votes
A tool declared -> dict returns only text content (JSON string) and structured_content=None with no output_schema, while -> dict[str, Any] or dict[str, int] or a pydantic model produces real structuredContent and an outputSchema. -> list[dict] is wrapped as {'result': [...]} and each element is also a separate text block; primitives are {'result': ...}. Unannotated params (def f(x, y=3)) are advertised as type: string in the input schema, even with default 3, so annotate everything. Optional[int]=None and list[int]=[1] generate anyOf [integer, null] with default and items; pydantic models become $ref/$defs. Tested mcp 2.3.0 and 1.30.0 (identical).