Skip to content

MCP Server Part 1: framework utilities and types#3710

Open
KoolADE85 wants to merge 8 commits intomcpfrom
feature/mcp-framework-foundations
Open

MCP Server Part 1: framework utilities and types#3710
KoolADE85 wants to merge 8 commits intomcpfrom
feature/mcp-framework-foundations

Conversation

@KoolADE85
Copy link
Copy Markdown
Contributor

@KoolADE85 KoolADE85 commented Apr 1, 2026

Summary

For schema generation:

  • Make Dash Component class compatible with Pydantic
  • Move NumberType definition out from individual components into a generic place where the type can be introspected (and also made compatible with Pydantic)
  • Add stronger type definitions for callbacks (CallbackDispatchBody, CallbackDispatchResponse)

Utilities

  • Add framework utilities for traversing layouts and inspecting Dash components (dash/layout.py)
  • Add pydantic>=2.10 to dependencies

Manual testing

There isn't any visible feature, but you can try out the layout traversal and pydantic type exposure by hand:

from dash import Dash, html, dcc
app = Dash(__name__)
app.layout = html.Div([
    html.Label("Name:", htmlFor="name-input"),
    " ",
    dcc.Input(id="name-input", value="World"),
    html.Div([html.Span(id="deep-child", children="deep text")], id="inner"),
], id="root")

with app.server.app_context():
    from dash.layout import traverse, find_component, extract_text
    for comp, ancestors in traverse(app.get_layout()):
        indent = "  " * len(ancestors)
        print(f"{indent}{type(comp).__name__} id={getattr(comp, 'id', None)}")

    from pydantic import TypeAdapter
    from dash.development.base_component import Component
    print(TypeAdapter(Component).json_schema())

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Thank you for your contribution to Dash! 🎉

This PR is exempt from requiring a linked issue due to its labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant