pub trait Tool:
Send
+ Sync
+ Default {
type Params: Serialize + for<'de> Deserialize<'de> + JsonSchema;
// Required methods
fn name(&self) -> &str;
fn execute_typed(
&self,
params: Self::Params,
context: &mut ToolContext<'_>,
) -> Result<ToolResult>;
// Provided methods
fn parameters_schema(&self) -> Value { ... }
fn execute(
&self,
params: Value,
context: &mut ToolContext<'_>,
) -> Result<ToolResult> { ... }
}Expand description
Trait for browser automation tools with associated parameter types
Required Associated Types§
Sourcetype Params: Serialize + for<'de> Deserialize<'de> + JsonSchema
type Params: Serialize + for<'de> Deserialize<'de> + JsonSchema
Associated parameter type for this tool
Required Methods§
Sourcefn execute_typed(
&self,
params: Self::Params,
context: &mut ToolContext<'_>,
) -> Result<ToolResult>
fn execute_typed( &self, params: Self::Params, context: &mut ToolContext<'_>, ) -> Result<ToolResult>
Execute the tool with strongly-typed parameters
Provided Methods§
Sourcefn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
Get tool parameter schema (JSON Schema)
Sourcefn execute(
&self,
params: Value,
context: &mut ToolContext<'_>,
) -> Result<ToolResult>
fn execute( &self, params: Value, context: &mut ToolContext<'_>, ) -> Result<ToolResult>
Execute the tool with JSON parameters (default implementation)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.