fix(mcp): split invoke_tool into read/write/destructive dispatchers - #665
Merged
Conversation
Replaces the single invoke_tool meta-tool with three typed invokers (invoke_read_tool, invoke_write_tool, invoke_destructive_tool), each admitting exactly one safety class with matching tool annotations. describe_tool names each tool's dispatcher via a new invokeTool field and the dispatchers enforce the class server-side.
This comment has been minimized.
This comment has been minimized.
Code Coverage ReportTotal Coverage: 50.1% Generated from commit: 1fc557e |
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
pcfreak30
marked this pull request as ready for review
September 2, 2026 07:00
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.
Replaces the single
invoke_toolmeta-tool with three typed invokers —invoke_read_tool,invoke_write_tool,invoke_destructive_tool— each admitting exactly one safety class and carrying matching tool annotations (read-only; mutating/open-world; destructive/open-world).search_toolsanddescribe_toolare unchanged, anddescribe_toolnow names the dispatcher for each tool (invokeToolfield); server instructions and guides direct agents to route by it. Each dispatcher enforces its safety class server-side and refuses out-of-class tools with a pointer to the right one.The split satisfies directory rules that reject one dispatcher mixing safe and unsafe operations and require annotations to match real capabilities.
Summary
This PR replaces the single
invoke_toolMCP meta-tool with three typed invoke dispatchers split by safety class:invoke_read_tool,invoke_write_tool, andinvoke_destructive_tool.Key changes
Typed invoke dispatchers
invoke_toolwith three safety-class-specific tools:invoke_read_tool— for read-only operations (marksreadOnlyHint=true)invoke_write_tool— for state-mutating operations (marksopenWorldHint=true)invoke_destructive_tool— for destructive/irreversible operations (marksdestructiveHint=true,openWorldHint=true)Routing improvements
describe_toolnow returns aninvokeToolfield inToolDetailnaming the correct dispatcher for each tool, so agents never guess which dispatcher to call.classifyEntry()to map a catalog entry's platform hints (destructive/readOnly/openWorld) to a safety class. Entries that are read-only but also declare openWorld are conservatively routed to the write dispatcher since the read contract would be contradictory.Documentation & test updates
describe_tool'sinvokeToolfield, with a cache to avoid repeated lookups.TestOfficialInvokeClassGateto lock the split: each dispatcher admits only its own class and refuses the rest.This change makes the MCP tool surface's safety annotations truthful for platform directory validation while preserving the progressive-disclosure discovery workflow.