Uh oh!
There was an error while loading. Please reload this page.
MCP Server Part 6: Format callback results for LLM consumption - #3748
Conversation
Thank you for your contribution to Dash! 🎉 This PR is exempt from requiring a linked issue due to its labels. |
9b3063f to
7451883Compare0e54d74 to
8a41b76Compare7451883 to
5fbf497Compare8a41b76 to
4fb9d4aCompare5fbf497 to
b564279Compare4fb9d4a to
10a544bCompareb564279 to
e2aec3dCompare2acb39d to
04ca2feCompare04ca2fe to
8f9d5a0Compare
camdecoster
left a comment
There was a problem hiding this comment.
Looks good. I add a few minor suggestions.
| formatters are called per output property and may add additional | ||
| content items (images, markdown, etc.). | ||
| """ | ||
| content: list[Any] = [ |
There was a problem hiding this comment.
Would using a dict instead of a list make more sense here? Then you wouldn't have to iterate through the list down below (assuming you could figure out which formatter to use before calling it).
There was a problem hiding this comment.
Thinking about this further, I'd like to keep the current structure for two reasons:
- consistency: the pattern of "iterate providers, each decides if it applies" is already used for input schemas, tool descriptions, and resource providers; I think it's valuable to keep a consistent pattern here too.
- flexibility: iterating lets each formatter decide dynamically whether it applies. While it's fairly static today, we are leaving room for multiple formatters to enrich the same output without restructuring later.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| ) | ||
| GENERIC_FIGURE = PropRole( | ||
| PLOTLY_FIGURE = PropRole( |
There was a problem hiding this comment.
Why is this change necessary?
There was a problem hiding this comment.
just a style choice: I wanted it to read more clearly when it's subsequently used in the result formatter, that we are actually concerned with formatting Plotly figures, not more "generic" figures.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
PlotlyFigureResult— rendersGraph.figureoutputs as PNG images via kaleido, returned asImageContentDataFrameResult— rendersDataTable.dataandAgGrid.rowDataoutputs as markdown tables, returned asTextContentManual verification: