pub struct McpToolBridge { /* private fields */ }Expand description
Wraps an MCP server tool as a native Tool.
Each bridge holds a reference to the McpManager so that invoke can
dispatch the call to the correct server.
Implementations§
Source§impl McpToolBridge
impl McpToolBridge
Sourcepub fn new(
server_id: String,
mcp_tool: McpTool,
manager: Arc<McpManager>,
) -> Self
pub fn new( server_id: String, mcp_tool: McpTool, manager: Arc<McpManager>, ) -> Self
Create a new bridge wrapping an MCP tool on a named server.
Sourcepub fn normalized_name(server_id: &str, tool_name: &str) -> String
pub fn normalized_name(server_id: &str, tool_name: &str) -> String
Normalized tool name: "mcp__<server>__<tool>".
This namespace avoids collisions when multiple MCP servers export tools with the same short name.
Trait Implementations§
Source§impl Tool for McpToolBridge
impl Tool for McpToolBridge
Source§fn definition(&self) -> ToolDefinition
fn definition(&self) -> ToolDefinition
Describe the tool’s name, prose description, and JSON-schema input.
Source§fn is_concurrency_safe(&self, _arguments: &Value) -> bool
fn is_concurrency_safe(&self, _arguments: &Value) -> bool
Whether the tool is safe to run concurrently with other invocations. Read more
Source§fn check_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_arguments: &'life1 Value,
_context: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<PermissionDecision, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn check_permission<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_arguments: &'life1 Value,
_context: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<PermissionDecision, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Decide whether the call is allowed, denied, or needs human approval. Read more
Source§fn invoke<'life0, 'async_trait>(
&'life0 self,
arguments: Value,
_context: ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolOutput, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invoke<'life0, 'async_trait>(
&'life0 self,
arguments: Value,
_context: ToolContext,
) -> Pin<Box<dyn Future<Output = Result<ToolOutput, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool. Errors are surfaced as
is_error: true tool results
rather than aborting the turn, so the model can try to recover.Source§fn prompt_text(&self) -> Option<&'static str>
fn prompt_text(&self) -> Option<&'static str>
Optional detailed usage instructions injected into the system prompt.
Return
None if the tool has no extra behavioral guidance.Source§fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_arguments: &'life1 Value,
_context: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_arguments: &'life1 Value,
_context: &'life2 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Validate raw arguments before the permission check runs. Read more
Source§fn interrupt_behavior(&self) -> InterruptBehavior
fn interrupt_behavior(&self) -> InterruptBehavior
How the tool wants to be interrupted.
Auto Trait Implementations§
impl Freeze for McpToolBridge
impl !RefUnwindSafe for McpToolBridge
impl Send for McpToolBridge
impl Sync for McpToolBridge
impl Unpin for McpToolBridge
impl UnsafeUnpin for McpToolBridge
impl !UnwindSafe for McpToolBridge
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