Summary
Running the call_tool cell in labs/module4/notebooks/1_mcp.ipynb raises:
AttributeError: 'list' object has no attribute 'model_dump_json'
The notebook is built against an older version of the mcp Python SDK where FastMCP.call_tool returned Sequence[ContentBlock]. Current SDK (mcp==1.26.0) returns a tuple (list[ContentBlock], dict) — (content, structured_result). Iterating the tuple yields the list (no .model_dump_json) and the dict, both of which fail.
Repro
- Branch:
main
- Open
labs/module4/notebooks/1_mcp.ipynb
- Run the cell containing:
async def call_tool(name, arguments):
results = await mcp_server.call_tool(name, arguments)
for result in results:
print(result.model_dump_json(indent=2))
asyncio.run(call_tool("get_alerts", {"state": "CA"}))
Environment
- Python 3.12.8
mcp==1.26.0
- Windows 11 / WSL-less (native)
Root cause
mcp.server.fastmcp.FastMCP.call_tool signature:
async def call_tool(self, name, arguments) -> Sequence[ContentBlock] | dict[str, Any]
But the runtime returns a 2-tuple (content, structured):
type(results): tuple
len(results): 2
[0] type=list, value=[TextContent(...)]
[1] type=dict, value={'result': '...'}
Proposed fix
Update the cell to unpack:
async def call_tool(name: str, arguments: Dict[str, Any]) -> None:
content, structured = await mcp_server.call_tool(name, arguments)
for result in content:
print(result.model_dump_json(indent=2))
Also check other call_tool usages in the notebook (and any sibling notebooks) for the same drift.
Scope
Limited to labs/module4/notebooks/1_mcp.ipynb — will expand if the same pattern is present elsewhere after audit.
Summary
Running the
call_toolcell inlabs/module4/notebooks/1_mcp.ipynbraises:The notebook is built against an older version of the
mcpPython SDK whereFastMCP.call_toolreturnedSequence[ContentBlock]. Current SDK (mcp==1.26.0) returns a tuple(list[ContentBlock], dict)—(content, structured_result). Iterating the tuple yields the list (no.model_dump_json) and the dict, both of which fail.Repro
mainlabs/module4/notebooks/1_mcp.ipynbEnvironment
mcp==1.26.0Root cause
mcp.server.fastmcp.FastMCP.call_toolsignature:But the runtime returns a 2-tuple
(content, structured):Proposed fix
Update the cell to unpack:
Also check other
call_toolusages in the notebook (and any sibling notebooks) for the same drift.Scope
Limited to
labs/module4/notebooks/1_mcp.ipynb— will expand if the same pattern is present elsewhere after audit.