pub struct McpToolAdapter { /* private fields */ }Expand description
Adapter that exposes an MCP tool as an agentkit Tool.
This is the tool-layer adapter for the tool registry. For the capabilities-layer
adapter, see McpInvocable. Tool names are prefixed as
mcp_<server_id>_<tool_name>.
§Example
use std::sync::Arc;
use agentkit_core::MetadataMap;
use agentkit_mcp::{McpToolAdapter, McpToolDescriptor, McpServerId};Implementations§
Source§impl McpToolAdapter
impl McpToolAdapter
Sourcepub fn new(
server_id: &McpServerId,
connection: Arc<McpConnection>,
descriptor: McpToolDescriptor,
) -> Self
pub fn new( server_id: &McpServerId, connection: Arc<McpConnection>, descriptor: McpToolDescriptor, ) -> Self
Creates a new tool adapter for the given MCP tool.
§Arguments
server_id- The server’s identifier, used to namespace the tool name.connection- A shared connection to the owning MCP server.descriptor- The tool descriptor obtained from discovery.
Trait Implementations§
Source§impl Tool for McpToolAdapter
impl Tool for McpToolAdapter
Source§fn invoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: ToolRequest,
_ctx: &'life1 mut ToolContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn invoke<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: ToolRequest,
_ctx: &'life1 mut ToolContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes the tool and returns a result or error. Read more
Source§fn current_spec(&self) -> Option<ToolSpec>
fn current_spec(&self) -> Option<ToolSpec>
Returns the current specification for this tool, if it should be
advertised right now. Read more
Source§fn proposed_requests(
&self,
_request: &ToolRequest,
) -> Result<Vec<Box<dyn PermissionRequest>>, ToolError>
fn proposed_requests( &self, _request: &ToolRequest, ) -> Result<Vec<Box<dyn PermissionRequest>>, ToolError>
Auto Trait Implementations§
impl Freeze for McpToolAdapter
impl !RefUnwindSafe for McpToolAdapter
impl Send for McpToolAdapter
impl Sync for McpToolAdapter
impl Unpin for McpToolAdapter
impl UnsafeUnpin for McpToolAdapter
impl !UnwindSafe for McpToolAdapter
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