pub struct ToolValueModel {
pub value_class: ValueClass,
pub field_groups: BTreeMap<String, FieldGroup>,
pub cost_model: CostModel,
pub follow_up: Vec<FollowUpLink>,
pub invalidates: Vec<String>,
pub fail_fast_after_n: Option<u32>,
pub side_effect_class: SideEffectClass,
pub rate_limit_host: Option<String>,
pub speculate: Option<bool>,
}Expand description
Provider-shipped, user-overridable description of how a tool fits into the enrichment knapsack.
Naming contract. Keys in AdaptiveConfig.tools and in the
[tools.<name>] TOML section are runtime tool names — exactly
what the LLM sends in tool_use.name (Read, Bash,
mcp__gitlab__get_issue, …). Do not anonymize them. The
mcp__p<hash6>__verb form only appears in the public corpus
aggregates under docs/research/data/paper3_*.csv; resolution
(AdaptiveConfig::effective_tool_value_model), cross-tool
invalidation (invalidates = […]) and the dedup cache all match
on the live runtime name, so an anonymized key would never resolve.
Fields§
§value_class: ValueClassFirst-pass importance class.
field_groups: BTreeMap<String, FieldGroup>Named subsets of the response — must_have, nice_to_have,
debug, and any provider-specific groups.
cost_model: CostModelToken / latency / freshness model.
follow_up: Vec<FollowUpLink>Empirically observed next tools — drives speculative prefetch.
invalidates: Vec<String>Tools whose cached responses become stale when this tool runs.
Mirrors the existing file-mutation hook in DedupCache: e.g.
update_issue.invalidates = ["get_issue", "get_issues"].
fail_fast_after_n: Option<u32>After how many consecutive empty (or no-change) calls the
planner should stop re-issuing this tool. None = never bail.
Set to Some(2) for ToolSearch per the corpus finding that
50%+ of repeated ToolSearch calls return zero results.
side_effect_class: SideEffectClassSide-effect classification — gates speculative pre-fetch.
Default Indeterminate keeps unannotated tools off the
speculation path; only Pure / ReadOnly are eligible.
rate_limit_host: Option<String>Optional default host for rate-limit grouping
(e.g. "github.com", "api.openai.com",
"gitlab.example.com"). The host’s speculative dispatcher
caps in-flight prefetches per rate_limit_host; None means
no rate budget tracked for this tool.
Static vs runtime. This is the static default. For tools
whose target host depends on runtime arguments (e.g. WebFetch
where the URL is per-call), the provider’s
crate::ToolEnricher::rate_limit_host override returns the
runtime value; the static field is only consulted as a
fallback.
speculate: Option<bool>Per-tool speculation override. When Some(false), the planner
is forbidden from speculating this tool even if
side_effect_class.is_speculatable(). Set automatically by
tune analyze’s R7 rule when the observed prefetch_hit_rate
for this tool falls below the floor — i.e. the planner was
guessing wrong too often. None = honour side_effect_class.
Implementations§
Source§impl ToolValueModel
impl ToolValueModel
Sourcepub fn critical_with_size(typical_kb: f32) -> Self
pub fn critical_with_size(typical_kb: f32) -> Self
Ergonomic constructor for the most common case: a critical tool with a known typical size and one likely follow-up.
Sourcepub fn audit_only() -> Self
pub fn audit_only() -> Self
Ergonomic constructor for an audit_only tool (TaskUpdate,
TodoWrite). Such tools never enter the knapsack budget.
Sourcepub fn excluded_from_budget(&self) -> bool
pub fn excluded_from_budget(&self) -> bool
True iff this tool’s responses should be excluded from the per-turn budget. Used by the planner’s first-pass filter.
Sourcepub fn is_speculatable(&self) -> bool
pub fn is_speculatable(&self) -> bool
True iff the planner is allowed to issue this tool ahead of
the LLM’s next message. Combines side_effect_class with the
per-tool speculate override — Some(false) always wins, so
tune analyze’s auto-disable rule cannot be bypassed by a
stale Pure annotation.
Trait Implementations§
Source§impl Clone for ToolValueModel
impl Clone for ToolValueModel
Source§fn clone(&self) -> ToolValueModel
fn clone(&self) -> ToolValueModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more