Drive MCP tool definitions and dispatch from proto messages#11368
Merged
tronical merged 3 commits intoslint-ui:masterfrom Apr 14, 2026
Merged
Drive MCP tool definitions and dispatch from proto messages#11368tronical merged 3 commits intoslint-ui:masterfrom
tronical merged 3 commits intoslint-ui:masterfrom
Conversation
Replace hand-written JSON schemas and manual string parsing with proto-driven generation: - Add RequestGetElementTree, RequestDispatchKeyEvent, and KeyEventType to slint_systest.proto so all 12 MCP tools have proto counterparts - Generate JSON schemas from proto descriptors at build time in build.rs - Replace 160 lines of hand-written JSON with a declarative TOOLS table mapping tool names to proto request types - Unify all tool handlers to use deserialize_params with proto types, eliminating manual string matching for enums and field extraction
Add match arms for RequestDispatchKeyEvent and RequestGetElementTree in the binary system-testing transport. These are MCP-only tools, so return an error when received over the system-testing channel.
tronical
approved these changes
Apr 14, 2026
Member
tronical
left a comment
There was a problem hiding this comment.
Thanks, that looks like a small overall reduction - worth it :)
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
Addresses review feedback from #11340: replace hand-written JSON schemas and manual string parsing in the MCP server with proto-driven generation.
RequestGetElementTree,RequestDispatchKeyEvent, andKeyEventTypeenum toslint_systest.protoso all 12 MCP tools have proto request counterpartsbuild.rsTOOLStable mapping tool names to proto request typesdeserialize_paramswith proto types, eliminating manual string matching for enums and manual JSON field extractionBreaking change for MCP clients:
drag_elementnow takestarget: { x, y }(matching the protoLogicalPosition) instead of flattargetX/targetY.dispatch_key_eventenum values changed from snake_case (press_and_release) to PascalCase (PressAndRelease) to match proto conventions.Test plan
cargo build -p i-slint-backend-testing --features mcpcompilescargo test -p i-slint-backend-testing --features mcp -- mcp— all 19 tests passtest_all_tools_have_proto_schemasvalidates every tool'srequest_typeresolves to a generated schema and alloptional_fieldsare real proto fields