Skip to content

πŸ› Bug: handling ToolCallResult with list type result is not available.Β #2685

@wangmir

Description

@wangmir

♻️ Reproduction Steps

  1. Connect MCP tool, which providesa list output schema.
  2. Call the MCP tool from tool node with AGUI protocol
Image

βœ… Expected Behavior

Can see the result without a problem.

❌ Actual Behavior

Seeing error from AGUI protocol library.
And cannot from the runtime side, the socket connection was disconnected. UI shows error.

𝌚 CopilotKit Version

[[package]]
name = "copilotkit"
version = "0.1.69"
source = { registry = "https://pypi.org/simple" }
dependencies = [
    { name = "ag-ui-langgraph", extra = ["fastapi"] },
    { name = "fastapi" },
    { name = "langchain" },
    { name = "langgraph" },
    { name = "partialjson" },
    { name = "toml" },
]
sdist = { url = "https://files.pythonhosted.org/packages/3e/34/f1762efaa19f85cd7472db642697460bdb562a8eeb87f47a992ce1fa674e/copilotkit-0.1.69.tar.gz", hash = "sha256:5ab8e1756750818d8ab853670f4b0362de7817b35188b9b70d7dc34c20cf77c9", size = 35567, upload-time = "2025-10-13T15:02:03.498Z" }
wheels = [
    { url = "https://files.pythonhosted.org/packages/09/4a/9562e92b8fa5212ced93d2e9d8d79cfa6731664a3a7b7b287ac56741fcfc/copilotkit-0.1.69-py3-none-any.whl", hash = "sha256:29f359399a1c01b9ce764a64f90063de6290fbdcccecd3cadaf092760bfc510b", size = 44545, upload-time = "2025-10-13T15:02:02.43Z" },
]

[[package]]
name = "ag-ui-langgraph"
version = "0.0.17"
source = { registry = "https://pypi.org/simple" }
dependencies = [
    { name = "ag-ui-protocol" },
    { name = "langchain" },
    { name = "langchain-core" },
    { name = "langgraph" },
]
sdist = { url = "https://files.pythonhosted.org/packages/8e/68/ba589032331d8cdf463c29753ae10d4f4eeac3da51b50f298829ca300864/ag_ui_langgraph-0.0.17.tar.gz", hash = "sha256:35aeb488de15c35a1354bc7c8dbe08c8844b03316ba2a848b67317155b44ffa9", size = 11400, upload-time = "2025-10-13T14:50:26.964Z" }
wheels = [
    { url = "https://files.pythonhosted.org/packages/41/bc/f4eecc64397e0c79d719ffca110f88cff0da848985b91e5d7c1dfdd7e86f/ag_ui_langgraph-0.0.17-py3-none-any.whl", hash = "sha256:0852e150abd84517de3813878022e805b9d995c67098c19007f3185623b960b2", size = 13074, upload-time = "2025-10-13T14:50:26.028Z" },
]

πŸ“„ Logs (Optional)

    |   File "/Users/wangmir/.local/share/uv/python/cpython-3.12.10-macos-aarch64-none/lib/python3.12/contextlib.py", line 158, in __exit__
    |     self.gen.throw(value)
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
    |     raise exc
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/starlette/responses.py", line 266, in wrap
    |     await func()
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/starlette/responses.py", line 246, in stream_response
    |     async for chunk in self.body_iterator:
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/ag_ui_langgraph/endpoint.py", line 21, in event_generator
    |     async for event in agent.run(input_data):
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/ag_ui_langgraph/agent.py", line 107, in run
    |     async for event_str in self._handle_stream_events(input.copy(update={"forwarded_props": forwarded_props})):
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/ag_ui_langgraph/agent.py", line 212, in _handle_stream_events
    |     async for single_event in self._handle_single_event(event, state):
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/copilotkit/langgraph_agui_agent.py", line 169, in _handle_single_event
    |     async for event_str in super()._handle_single_event(event, state):
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/ag_ui_langgraph/agent.py", line 706, in _handle_single_event
    |     ToolCallResultEvent(
    |   File "/Users/wangmir/Works/source/cloud-vehicle-twin-2a/supervisor_agent/.venv/lib/python3.12/site-packages/pydantic/main.py", line 250, in __init__
    |     validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | pydantic_core._pydantic_core.ValidationError: 1 validation error for ToolCallResultEvent
    | content
    |   Input should be a valid string [type=string_type, input_value=['T:"CleanupHistoryrepres...edges"edges:[UserEdge]'], input_type=list]
    |     For further information visit https://errors.pydantic.dev/2.12/v/string_type
    +------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions