Repository navigation
refactor(tools): replace positional definitions with named declarations - #1404
Merged
Merged
Conversation
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.
Tool definitions used a 13-argument
def(...)constructor, with positional booleans for Project requirements, destructive intent and shell-like execution. Replace it with a privateToolDeclarationwhose fields are all required and named, so reviewers can read each setting directly and omissions remain compile errors. NoDefaultor new policy presets are introduced.Migrate all 109 calls: 99 become named declarations and 10 reuse the existing narrow
control_defconstructor after verifying that their fixed fields match its contract. Keep canonical ToolDefinition construction, existing modifiers and the shared Runner-read/Control contracts. This is a maintenance simplification with essentially flat size: net +4 lines across 24 declaration-layer files.Validation:
cargo test --locked -p webcodex-tool-contracts --lib -- --quiet— 348 passed, 1 existing ignored.cargo test --locked -p webcodex-tool-contracts --lib --all-features -- --quiet— 353 passed, 1 existing ignored.cargo test --locked -p webcodex --lib -- tool_runtime::tests::metadata tool_runtime::tests::permission_gate mcp::tests::oauth_scope mcp::tests::tool_exposure --quiet— 98 passed. The same three pre-existing unused-code warnings remain.git diff --checkpassed.Tool order, descriptions, schemas, annotations, scopes, capabilities, audit and Session evidence policies remain unchanged.