π The fast, Pythonic way to build MCP servers and clients.
Look up call_tool output schemas across all tools/list pages (#5338)
Asem ahmed0f708469ef1d
diff --git a/fastmcp_slim/fastmcp/client/mixins/tools.py b/fastmcp_slim/fastmcp/client/mixins/tools.pyindex 10043d7cc..07c20a033 100644--- a/fastmcp_slim/fastmcp/client/mixins/tools.py+++ b/fastmcp_slim/fastmcp/client/mixins/tools.py@@ -272,7 +272,9 @@ class ClientToolsMixin:name=name,result=result,tool_output_schemas=self.session._tool_output_schemas,- list_tools_fn=self.session.list_tools,+ # Fetch every page: a tool beyond the first page is otherwise never+ # found, and its result is left unhydrated.+ list_tools_fn=self.list_tools,client_name=self.name,raise_on_error=raise_on_error,)diff --git a/tests/client/client/test_client.py b/tests/client/client/test_client.pyindex 8e3655306..47b0061d0 100644--- a/tests/client/client/test_client.py+++ b/tests/client/client/test_client.py@@ -2,6 +2,7 @@import asyncioimport contextlib+import datetimefrom collections.abc import AsyncIteratorfrom typing import Any, cast@@ -913,6 +914,29 @@ async def test_client_structured_content_without_output_schema(structured_contenassert type(result.data) is type(structured_content)[email protected]("list_first", [False, True])+async def test_client_hydrates_data_for_tool_beyond_first_list_page(list_first: bool):+ """A tool's output schema is found even when it is not on the first page."""+ server = FastMCP(list_page_size=1)++ @server.tool+ def first() -> int:+ return 1++ @server.tool+ def when() -> datetime.datetime:+ return datetime.datetime(2026, 1, 1, 12, 0)++ async with Client(server) as client:+ if list_first:+ await client.list_tools()+ result = await client.call_tool("when")++ assert result.structured_content == {"result": "2026-01-01T12:00:00"}+ assert result.data == datetime.datetime(2026, 1, 1, 12, 0)+ assert type(result.data) is datetime.datetime++async def test_client_list_dict_return_type():"""list[dict] return type should produce list of dicts, not Root() objects (issue #3867)."""server = FastMCP()