pub struct DefaultIntentRouter { /* private fields */ }Expand description
Default IntentRouter that scores registered tools against a token and
returns the highest-ranked candidate’s route. Pure-data routing — no
embeddings (the semantic CapabilityIndex lands in a separate slice);
this router relies on verb match plus capability overlap.
Scoring (higher is better):
- exact verb match (namespace + action) →
+2.0 - namespace-only match →
+1.0 - MCP coarse-verb fallback (
mcp.<tool_name>matches the SIT’s action) →+0.5 - Jaccard overlap of
required_capabilities×tool.capabilities→× 1.5
When no tool clears 0.0, the router emits
ToolRoute::HumanConfirm { ask } describing the unresolved verb — the
pipeline surfaces that back to the user instead of guessing.
Implementations§
Source§impl DefaultIntentRouter
impl DefaultIntentRouter
pub fn new(registry: Arc<dyn ToolRegistry>) -> Self
Sourcepub fn with_breakers(self, breakers: Arc<dyn BreakerCheck>) -> Self
pub fn with_breakers(self, breakers: Arc<dyn BreakerCheck>) -> Self
Wire a BreakerCheck so Open tools are excluded from scoring.
Without one, every registered tool is considered.
Sourcepub fn score(tok: &IntentToken, tool: &ToolDescriptor) -> f32
pub fn score(tok: &IntentToken, tool: &ToolDescriptor) -> f32
Score a single candidate against the token. Public so callers /
tests can probe the ranking without invoking resolve.
Trait Implementations§
Source§impl IntentRouter for DefaultIntentRouter
impl IntentRouter for DefaultIntentRouter
Auto Trait Implementations§
impl !RefUnwindSafe for DefaultIntentRouter
impl !UnwindSafe for DefaultIntentRouter
impl Freeze for DefaultIntentRouter
impl Send for DefaultIntentRouter
impl Sync for DefaultIntentRouter
impl Unpin for DefaultIntentRouter
impl UnsafeUnpin for DefaultIntentRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more