pub trait ToolBase {
type Parameter: for<'de> Deserialize<'de> + JsonSchema + Send + Default + 'static;
type Output: Serialize + JsonSchema + Send + 'static;
type Error: Into<ErrorData> + Send + 'static;
// Required method
fn name() -> Cow<'static, str>;
// Provided methods
fn title() -> Option<String> { ... }
fn description() -> Option<Cow<'static, str>> { ... }
fn input_schema() -> Option<Arc<JsonObject>> { ... }
fn output_schema() -> Option<Arc<JsonObject>> { ... }
fn annotations() -> Option<ToolAnnotations> { ... }
fn execution() -> Option<ToolExecution> { ... }
fn icons() -> Option<Vec<Icon>> { ... }
fn meta() -> Option<Meta> { ... }
}server only.Expand description
Required Associated Types§
Sourcetype Parameter: for<'de> Deserialize<'de> + JsonSchema + Send + Default + 'static
type Parameter: for<'de> Deserialize<'de> + JsonSchema + Send + Default + 'static
Parameter type, will used in the invoke parameter of SyncTool or AsyncTool trait
If the tool does not have any parameters, you MUST override input_schema
method. See its documentation for more details.
Sourcetype Output: Serialize + JsonSchema + Send + 'static
type Output: Serialize + JsonSchema + Send + 'static
Output type, will used in the invoke output of SyncTool or AsyncTool trait
If the tool does not have any output, you MUST override output_schema
method. See its documentation for more details.
Required Methods§
Provided Methods§
fn title() -> Option<String>
fn description() -> Option<Cow<'static, str>>
Sourcefn input_schema() -> Option<Arc<JsonObject>>
fn input_schema() -> Option<Arc<JsonObject>>
Json schema for tool input.
The default implementation generates schema based on Self::Parameter type.
If the tool does not have any parameters, you should override this methods to return None,
and when invoked, the parameter will get default values.
Sourcefn output_schema() -> Option<Arc<JsonObject>>
fn output_schema() -> Option<Arc<JsonObject>>
Json schema for tool output.
The default implementation generates schema based on Self::Output type.
If the tool does not have any output, you should override this methods to return None.
fn annotations() -> Option<ToolAnnotations>
fn execution() -> Option<ToolExecution>
fn icons() -> Option<Vec<Icon>>
fn meta() -> Option<Meta>
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.