from_fastapi: tuple responses containing a model fail with an unresolved schema reference
Author: asts-topCreated Sep 16, 2026Updated Sep 16, 2026
Labelsbugopenapi
What happened?
A FastAPI endpoint returning tuple[Item, int] works over HTTP, but after conversion with FastMCP.from_fastapi(), Client.call_tool() raises PointerToNowhere: '/components/schemas/Item' does not exist while validating the successful response. I expected structured_content to contain {"result": [{"name": "example"}, 2]}.
Example Code
import asyncio
from fastapi import FastAPI
from pydantic import BaseModel
from fastmcp import Client, FastMCP
class Item(BaseModel):
name: str
app = FastAPI()
@app.post("/items", operation_id="get_item")
def get_item() -> tuple[Item, int]:
return Item(name="example"), 2
async def main() -> None:
server = FastMCP.from_fastapi(app)
async with Client(server) as client:
result = await client.call_tool("get_item")
print(result.structured_content)
asyncio.run(main())Version Information
Reproduced on main at 490049f0f9742922f4af16c937db0b898dc9802b, with MCP 2.0.0, FastAPI 0.139.2, Pydantic 2.13.4, and jsonschema 4.26.0. Python 3.12 on Windows and Ubuntu.
Source: PrefectHQ/fastmcp