Skip to content

feat(scripted_tool): add ScriptingToolSet with discovery mode support#534

Merged
chaliy merged 4 commits intomainfrom
claude/scripting-tool-modes-ofGvK
Mar 14, 2026
Merged

feat(scripted_tool): add ScriptingToolSet with discovery mode support#534
chaliy merged 4 commits intomainfrom
claude/scripting-tool-modes-ofGvK

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 14, 2026

Summary

  • Adds ScriptingToolSet, a higher-level wrapper around ScriptedTool that controls system_prompt() generation based on DiscoveryMode
  • Exclusive mode (default): full tool schemas in prompt — best when this is the only tool the LLM has
  • WithDiscovery mode: semantic descriptions only, LLM uses discover and help builtins — best for large tool sets or alongside other tools
  • Fixes pre-existing clippy warning in mcp.rs (unused mut)

What

  • New ScriptingToolSet struct implementing the Tool trait, delegating execution to inner ScriptedTool
  • ScriptingToolSetBuilder with fluent API: .tool(), .env(), .limits(), .short_description(), .with_discovery()
  • DiscoveryMode enum (Exclusive | WithDiscovery)
  • Updated spec 014 with ScriptingToolSet documentation and module layout

Why

When ScriptedTool is used alongside other discovery-capable tools, full schemas in the system prompt waste tokens. ScriptingToolSet lets the caller choose: full schemas upfront (exclusive) or semantic-only with discover/help builtins (discovery mode).

Test plan

  • 17 unit tests covering both modes, prompt content, execution delegation, status callbacks, builtins, env vars, schemas
  • cargo fmt --check passes
  • cargo clippy --all-targets -- -D warnings passes
  • cargo test --all-features passes (all 1575 tests)
  • Feature-gated build with and without scripted_tool feature

chaliy added 4 commits March 14, 2026 02:19
ScriptingToolSet wraps ScriptedTool with mode-controlled system_prompt():
- Exclusive (default): full schemas in prompt, LLM knows everything upfront
- WithDiscovery: semantic descriptions only, LLM uses discover/help builtins

New types: ScriptingToolSet, ScriptingToolSetBuilder, DiscoveryMode.
Implements Tool trait, delegates execution to inner ScriptedTool.
@chaliy chaliy merged commit 3abf1f5 into main Mar 14, 2026
23 checks passed
@chaliy chaliy deleted the claude/scripting-tool-modes-ofGvK branch March 14, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant