Description
Please read this first
- Have you read the docs?Agents SDK docs
- Yes
- Have you searched for related issues? Others may have faced similar issues.
Yes
Describe the bug
A clear and concise description of what the bug is.
When we are using local model ( ollama for example ) the result not necessary contains content here, in my case, it was result[0].text
I added a local patch
# The MCP tool result is a list of content items, whereas OpenAI tool outputs are a single
# string. We'll try to convert.
logger.info(f"Tool result content: ", result[0].text)
if len(result.content) == 1:
tool_output = result.content[0].model_dump_json()
elif len(result.content) > 1:
logger.info(f"Tool result content: ", result[0].text)
Message: 'Tool result content: '
Arguments: ('{"content": "{\\"ids\\": [[\\"caf665b7-cb2e-428d-9139-ff6da8687731\\", \\"f3d34cf7-d263-4dd4-b84f-b63f4258b43c\\", \\"4d649cfa-2c79-497b-8e27-bae7c8925311\\", \\"f2677a99-99ff-49ad-be52-b1e078a9b56a\\", \\"b463d689-bebb-4752-9e4f-f42395f977db\\"]], \\"embeddings\\": null, \\"documents\\": [[\\"The movie begin
File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/agents/mcp/util.py", line 116, in invoke_mcp_tool
if len(result.content) == 1:
^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'content'
Debug information
- Agents SDK version: (v0.0.13`)
- Python version (Python 3.11.5)
Repro steps
Ideally provide a minimal python script that can be run to reproduce the bug.
Please find my repo here https://github.com/Czhang0727/object-rag
You can reproduce by running server/agents_components/evaluation/run_router_demo.py
Expected behavior
A clear and concise description of what you expected to happen.
We should not fail the call, the result should deliver to final output