File tree Expand file tree Collapse file tree
dash/mcp/primitives/tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -385,7 +385,7 @@ def _expand_output_spec(
385385 output_id : str ,
386386 cb_info : dict ,
387387 resolved_inputs : list [CallbackInput ],
388- ) -> list [CallbackOutputTarget ]:
388+ ) -> CallbackOutputTarget | list [CallbackOutputTarget ]:
389389 """Build the outputs spec, expanding wildcards to concrete IDs.
390390
391391 For wildcard outputs, derives concrete IDs from the resolved inputs.
@@ -417,6 +417,11 @@ def _expand_output_spec(
417417 else :
418418 results .append ({"id" : pid , "property" : prop })
419419
420+ # Mirror the Dash renderer: single-output callbacks send a bare dict,
421+ # multi-output callbacks send a list. The framework's output value
422+ # matching depends on this shape.
423+ if len (results ) == 1 :
424+ return results [0 ]
420425 return results
421426
422427
Original file line number Diff line number Diff line change 1- """Output schema derived from CallbackDispatchResponse ."""
1+ """Output schema derived from CallbackExecutionResponse ."""
22
33from __future__ import annotations
44
55from typing import Any
66
77from pydantic import TypeAdapter
88
9- from dash .types import CallbackDispatchResponse
9+ from dash .types import CallbackExecutionResponse
1010
11- _schema = TypeAdapter (CallbackDispatchResponse ).json_schema ()
11+ _schema = TypeAdapter (CallbackExecutionResponse ).json_schema ()
1212
1313
1414def callback_response_schema () -> dict [str , Any ]:
Original file line number Diff line number Diff line change 1515
1616from pydantic import TypeAdapter
1717from dash .development .base_component import Component
18- from dash .types import CallbackDispatchResponse
18+ from dash .types import CallbackExecutionResponse
1919
2020_DASH_COMPONENT_SCHEMA = TypeAdapter (Component ).json_schema ()
2121
5151 },
5252 },
5353 },
54- "outputSchema" : TypeAdapter (CallbackDispatchResponse ).json_schema (),
54+ "outputSchema" : TypeAdapter (CallbackExecutionResponse ).json_schema (),
5555}
5656
5757
You can’t perform that action at this time.
0 commit comments