MCP Server Part 4: Expose callbacks as tools#3731
Open
KoolADE85 wants to merge 3 commits intofeature/mcp-resourcesfrom
Open
MCP Server Part 4: Expose callbacks as tools#3731KoolADE85 wants to merge 3 commits intofeature/mcp-resourcesfrom
KoolADE85 wants to merge 3 commits intofeature/mcp-resourcesfrom
Conversation
|
Thank you for your contribution to Dash! 🎉 You can link an issue by:
This check will automatically pass once an issue is linked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR turns Dash callbacks into fully-described MCP tools. Each tool has four main parts:
Tool description (
descriptions/)A human-readable summary of what the callback does. Built from pluggable sources that each contribute lines:
description_outputs.py— semantic summary of what the callback returns (e.g. "Returns chart/visualization data" for aGraph.figureoutput)description_docstring.py— the callback function's Python docstringEach source extracts what it needs from a given
CallbackAdapterin order to produce text descriptions. New sources can be added by appending to the_SOURCESlist.Input schema (
input_schemas/)JSON Schema that describes valid inputs for each callback parameter. Each schema is derived from:
def callback(metric: str):→{"type": "string"})Input("dropdown", "value")→{"type": { "anyOf": ["string", "number", "boolean", null]}})multi=True)Input description (
input_descriptions/)Each parameter also gets a text description assembled from various sources:
html.Labelthat is associated with the inputoptions,min/max,value, etc) and any chained callbacks that set values for this inputOutput schema (
output_schemas/)JSON Schema for the tool's
outputSchemafielddash-renderer.Manual testing
You can see the JSON that will be presented to LLMs by testing manually: