Commit 3abf1f5
authored
feat(scripted_tool): add ScriptingToolSet with discovery mode support (everruns#534)
## 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
- [x] 17 unit tests covering both modes, prompt content, execution
delegation, status callbacks, builtins, env vars, schemas
- [x] `cargo fmt --check` passes
- [x] `cargo clippy --all-targets -- -D warnings` passes
- [x] `cargo test --all-features` passes (all 1575 tests)
- [x] Feature-gated build with and without `scripted_tool` feature1 parent e176196 commit 3abf1f5
4 files changed
Lines changed: 613 additions & 3 deletions
File tree
- crates/bashkit/src
- scripted_tool
- specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
401 | 404 | | |
402 | 405 | | |
403 | 406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| |||
0 commit comments