Skip to content

Conversation

hashemix
Copy link
Member

@hashemix hashemix commented Feb 28, 2025

📌 Summary

Added new utility functions for creating and converting types related to CallToolResult calls. These functions simplify the process of creating CallToolResult instances or returning errors when a CallToolRequest fails.

Usage example:

  • Return a Unknown Tool Error
 async fn handle_call_tool_request(
        &self,
        request: CallToolRequest,
    ) -> Result<CallToolResult, CallToolError> {

       ////............

       return Err(CallToolError::unknown_tool(tool_name)),

}
  • Return a CallToolResult with TextContent :
async fn handle_call_tool_request(
        &self,
        request: CallToolRequest,
    ) -> Result<CallToolResult, CallToolError> {

       ////............

       return Ok(CallToolResult::text_content(
                    format!( "Successfully created directory {}", path),
                    None,
                ));

}

@hashemix hashemix merged commit 0b8f622 into main Mar 2, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant