pub struct CustomTool {
pub slug: String,
pub name: String,
pub description: String,
pub toolkit: Option<String>,
pub input_schema: Value,
pub output_schema: Option<Value>,
pub requires_auth: bool,
/* private fields */
}Expand description
Custom tool definition with execution logic
Fields§
§slug: StringTool slug (unique identifier, uppercase)
name: StringTool name (human-readable)
description: StringTool description
toolkit: Option<String>Toolkit slug (if toolkit-based)
input_schema: ValueInput parameters schema (JSON Schema)
output_schema: Option<Value>Output schema (optional)
requires_auth: boolWhether authentication is required
Implementations§
Source§impl CustomTool
impl CustomTool
Sourcepub fn new_simple<F>(
name: &str,
description: &str,
input_schema: JsonValue,
executor: F,
client: Arc<ComposioClient>,
) -> Self
pub fn new_simple<F>( name: &str, description: &str, input_schema: JsonValue, executor: F, client: Arc<ComposioClient>, ) -> Self
Create a simple custom tool without authentication
§Arguments
name- Tool name (will be converted to uppercase slug)description- Tool descriptioninput_schema- JSON Schema for input parametersexecutor- Function to execute the toolclient- Composio client
Sourcepub fn new_with_auth<F>(
name: &str,
description: &str,
toolkit: &str,
input_schema: JsonValue,
executor: F,
client: Arc<ComposioClient>,
) -> Self
pub fn new_with_auth<F>( name: &str, description: &str, toolkit: &str, input_schema: JsonValue, executor: F, client: Arc<ComposioClient>, ) -> Self
Create a toolkit-based custom tool with authentication
§Arguments
name- Tool name (will be prefixed with toolkit and converted to uppercase)description- Tool descriptiontoolkit- Toolkit slug (e.g., “github”)input_schema- JSON Schema for input parametersexecutor- Function to execute the tool (receives proxy executor and credentials)client- Composio client
Sourcepub async fn execute(
&self,
arguments: HashMap<String, JsonValue>,
user_id: Option<&str>,
) -> Result<JsonValue, ComposioError>
pub async fn execute( &self, arguments: HashMap<String, JsonValue>, user_id: Option<&str>, ) -> Result<JsonValue, ComposioError>
Execute the custom tool
§Arguments
arguments- Input argumentsuser_id- User ID (required for authenticated tools)
Sourcepub fn to_tool_info(&self) -> ToolInfo
pub fn to_tool_info(&self) -> ToolInfo
Convert to ToolInfo format (for API compatibility)
Auto Trait Implementations§
impl Freeze for CustomTool
impl !RefUnwindSafe for CustomTool
impl Send for CustomTool
impl Sync for CustomTool
impl Unpin for CustomTool
impl UnsafeUnpin for CustomTool
impl !UnwindSafe for CustomTool
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