Skip to content

[BUG] MCP errors in get_dash_component tool #4113

Description

@KoolADE85

When the get_dash_component MCP tool queries a container whose children contains Dash components, an error is raised:

MCP error: Unable to serialize unknown type: <class 'dash.html.H1.H1'>
Traceback (most recent call last):
  File "/home/aborrmann/projects/dash/dash/mcp/_server.py", line 337, in _dispatch_mcp_message
    result=result.model_dump(exclude_none=True, mode="json"),
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aborrmann/projects/dash-user/.venv-editable/lib64/python3.14/site-packages/pydantic/main.py", line 475, in model_dump
    return self.__pydantic_serializer__.to_python(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self,
        ^^^^^
    ...<13 lines>...
        polymorphic_serialization=polymorphic_serialization,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'dash.html.H1.H1'>

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cyclebugsomething brokensize: 1

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions