pub struct BinaryTrieRouter { /* private fields */ }Expand description
Compile-time generated tool router with O(1) dispatch
Implementations§
Source§impl BinaryTrieRouter
impl BinaryTrieRouter
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a router with pre-allocated capacity
Sourcepub fn register(
&mut self,
handler: Box<dyn ToolHandler>,
) -> Result<u16, DCPError>
pub fn register( &mut self, handler: Box<dyn ToolHandler>, ) -> Result<u16, DCPError>
Register a tool handler
Sourcepub fn tool_schema(&self, tool_id: u16) -> Option<&ToolSchema>
pub fn tool_schema(&self, tool_id: u16) -> Option<&ToolSchema>
Get the registered schema for a tool ID.
Sourcepub fn execute(
&self,
tool_id: u16,
args: &SharedArgs<'_>,
) -> Result<ToolResult, DCPError>
pub fn execute( &self, tool_id: u16, args: &SharedArgs<'_>, ) -> Result<ToolResult, DCPError>
Raw tool execution is deny-by-default.
Runtime callers must use execute_authorized with a negotiated
capability manifest so tool execution cannot bypass authorization.
Execute a tool only if it is present in the negotiated capability set.
Execute a signed invocation only after signature, args hash, negotiated capability, schema, and replay checks all pass.
Sourcepub fn resolve_name(&self, name: &str) -> Option<u16>
pub fn resolve_name(&self, name: &str) -> Option<u16>
Resolve tool name to ID (for MCP compatibility)
Sourcepub fn max_tool_id(&self) -> u16
pub fn max_tool_id(&self) -> u16
Get the maximum registered tool ID
Sourcepub fn tool_count(&self) -> usize
pub fn tool_count(&self) -> usize
Get the number of registered tools
Sourcepub fn tool_names(&self) -> impl Iterator<Item = &str>
pub fn tool_names(&self) -> impl Iterator<Item = &str>
Get all registered tool names
Sourcepub fn capabilities(&self) -> ServerCapabilities
pub fn capabilities(&self) -> ServerCapabilities
Get server capabilities based on registered tools
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BinaryTrieRouter
impl !UnwindSafe for BinaryTrieRouter
impl Freeze for BinaryTrieRouter
impl Send for BinaryTrieRouter
impl Sync for BinaryTrieRouter
impl Unpin for BinaryTrieRouter
impl UnsafeUnpin for BinaryTrieRouter
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