pub struct ToolCallbackHandler { /* private fields */ }Expand description
Tool Callback Handler
Handles tool callback requests from external extension services.
Implementations§
Source§impl ToolCallbackHandler
impl ToolCallbackHandler
Sourcepub fn new(
security: Arc<SecurityValidator>,
tool_router: Arc<ToolRouter>,
) -> Self
pub fn new( security: Arc<SecurityValidator>, tool_router: Arc<ToolRouter>, ) -> Self
Create a new tool callback handler
Sourcepub fn with_allowed_tools(self, config: AllowedToolsConfig) -> Self
pub fn with_allowed_tools(self, config: AllowedToolsConfig) -> Self
Set allowed tools configuration
Sourcepub fn with_timeout(self, timeout_ms: u64) -> Self
pub fn with_timeout(self, timeout_ms: u64) -> Self
Set default timeout
Sourcepub async fn handle(
&self,
request: ToolCallbackRequest,
) -> Result<ToolCallbackResult, ToolCallbackError>
pub async fn handle( &self, request: ToolCallbackRequest, ) -> Result<ToolCallbackResult, ToolCallbackError>
Handle a tool callback request
Sourcepub fn create_error_response(
&self,
error: ToolCallbackError,
id: JsonRpcId,
) -> JsonRpcResponse
pub fn create_error_response( &self, error: ToolCallbackError, id: JsonRpcId, ) -> JsonRpcResponse
Create a JSON-RPC error response for tool callback failures
Sourcepub fn list_allowed_tools(&self) -> Vec<String>
pub fn list_allowed_tools(&self) -> Vec<String>
List allowed tools
Sourcepub async fn tool_exists(&self, tool_name: &str) -> bool
pub async fn tool_exists(&self, tool_name: &str) -> bool
Check if tool exists in router
Auto Trait Implementations§
impl !RefUnwindSafe for ToolCallbackHandler
impl !UnwindSafe for ToolCallbackHandler
impl Freeze for ToolCallbackHandler
impl Send for ToolCallbackHandler
impl Sync for ToolCallbackHandler
impl Unpin for ToolCallbackHandler
impl UnsafeUnpin for ToolCallbackHandler
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