Skip to content

Comments

refactor(tools): schemars-based tool registry, invocation hints#267

Merged
bug-ops merged 3 commits intomainfrom
feat/m20/tool-registry-refactor
Feb 14, 2026
Merged

refactor(tools): schemars-based tool registry, invocation hints#267
bug-ops merged 3 commits intomainfrom
feat/m20/tool-registry-refactor

Conversation

@bug-ops
Copy link
Owner

@bug-ops bug-ops commented Feb 14, 2026

Summary

  • Replace manual ParamDef/ParamType with schemars 1.2 #[derive(JsonSchema)] on tool parameter structs
  • Add InvocationHint enum (FencedBlock("bash")/FencedBlock("scrape")/ToolCall) to ToolDef so LLM knows exact invocation format
  • Delete builtin_tools() duplication — each executor owns its tool_definitions() (single source of truth)
  • ToolRegistry::from_definitions() replaces hardcoded new()
  • format_for_prompt() renders invocation instructions and schema-derived parameter docs
  • Fix web_scrape missing params (select, extract, limit) — now auto-derived from ScrapeInstruction

Test plan

  • cargo clippy clean (zero warnings)
  • cargo nextest 1347 passed, 0 failed
  • Performance validation: < 100us per turn
  • Security audit: schemars MIT, no vulnerabilities
  • Code review: approved

…chema

- Add schemars 1.2 for compile-time JSON Schema generation
- Replace ParamDef/ParamType with schemars::Schema in ToolDef
- Add InvocationHint enum (FencedBlock/ToolCall) so LLM knows invocation format
- Delete builtin_tools() duplication, each executor owns its tool_definitions()
- Add #[derive(JsonSchema)] to ScrapeInstruction, BashParams, file param structs
- ToolRegistry::from_definitions() replaces hardcoded new()
- format_for_prompt() renders invocation instructions and schema params
- Agent builds registry from executor definitions (single source of truth)
- Fix Option<T> type rendering in format_schema_params (extract non-null type from schemars array format)
- Remove dead format_for_prompt() method, use filtered variant everywhere
- Make param structs pub(crate) to eliminate test duplication
- Add negative assertion for optional extract param in scrape tests
- Add schema-only context comments on param structs
@codecov-commenter
Copy link

codecov-commenter commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 95.14563% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/zeph-tools/src/registry.rs 92.24% 9 Missing ⚠️
crates/zeph-core/src/agent.rs 0.00% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #267      +/-   ##
==========================================
- Coverage   81.23%   81.15%   -0.08%     
==========================================
  Files          83       83              
  Lines       24614    24552      -62     
==========================================
- Hits        19994    19924      -70     
- Misses       4620     4628       +8     
Files with missing lines Coverage Δ
crates/zeph-tools/src/file.rs 93.31% <100.00%> (-0.65%) ⬇️
crates/zeph-tools/src/scrape.rs 94.03% <100.00%> (+0.36%) ⬆️
crates/zeph-tools/src/shell.rs 97.14% <100.00%> (+0.09%) ⬆️
crates/zeph-core/src/agent.rs 69.14% <0.00%> (ø)
crates/zeph-tools/src/registry.rs 94.79% <92.24%> (-4.45%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Feb 14, 2026
@bug-ops bug-ops enabled auto-merge (squash) February 14, 2026 17:57
@bug-ops bug-ops merged commit f349048 into main Feb 14, 2026
20 checks passed
@bug-ops bug-ops deleted the feat/m20/tool-registry-refactor branch February 14, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants