pub struct RoutingDecision {
pub primary: RoutingTarget,
pub fallback: Option<RoutingTarget>,
pub reason: RoutingReason,
pub resolved_name: String,
pub decided_at: Instant,
}Expand description
Final routing plan for one invocation.
Fields§
§primary: RoutingTargetExecutor to try first.
fallback: Option<RoutingTarget>Executor to retry on error. None when no fallback applies.
reason: RoutingReasonWhy this decision was made — included in telemetry and debug logs.
resolved_name: StringThe resolved unprefixed tool name after stripping any explicit prefix.
decided_at: InstantMoment the decision was made. Useful downstream for timing analysis.
Implementations§
Source§impl RoutingDecision
impl RoutingDecision
Sourcepub fn to_meta_json(&self) -> Value
pub fn to_meta_json(&self) -> Value
Produce a _meta.routing JSON blob suitable for attaching to an MCP response.
Consumers pack this under _meta so downstream tooling (CLI debug output, logs)
can inspect the decision without parsing free-form text.
Sourcepub fn emit_tracing(&self, requested_name: &str)
pub fn emit_tracing(&self, requested_name: &str)
Structured tracing log describing this decision. Emitted once per invocation at info level so operators can grep for routing outcomes without enabling debug.
pub fn local(name: impl Into<String>, reason: RoutingReason) -> Self
pub fn remote( prefix: impl Into<String>, original_name: impl Into<String>, reason: RoutingReason, ) -> Self
pub fn reject(name: impl Into<String>, reason: RoutingReason) -> Self
pub fn with_fallback(self, fallback: RoutingTarget) -> Self
Trait Implementations§
Source§impl Clone for RoutingDecision
impl Clone for RoutingDecision
Source§fn clone(&self) -> RoutingDecision
fn clone(&self) -> RoutingDecision
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RoutingDecision
impl RefUnwindSafe for RoutingDecision
impl Send for RoutingDecision
impl Sync for RoutingDecision
impl Unpin for RoutingDecision
impl UnsafeUnpin for RoutingDecision
impl UnwindSafe for RoutingDecision
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