pub trait Tool: Clone {
// Required methods
fn name(&self) -> &'static str;
fn description(&self) -> &'static str;
fn input_schema(&self) -> Value;
fn call(&self, arguments: &Value) -> Result<ToolResult, ToolError>;
// Provided methods
fn server_name(&self) -> String { ... }
fn server_version(&self) -> &'static str { ... }
fn capabilities(&self) -> Value { ... }
}
Expand description
Trait that all FTL Core tools must implement
This trait defines a single computational tool optimized for WebAssembly performance. FTL Core follows the “1 tool per server” architecture for maximum efficiency.
Required Methods§
Sourcefn description(&self) -> &'static str
fn description(&self) -> &'static str
Human-readable description of what the tool does
Sourcefn input_schema(&self) -> Value
fn input_schema(&self) -> Value
JSON schema for the tool’s input parameters
Return a JSON object describing the expected input structure. Example:
{
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "The text to process"
}
},
"required": ["text"]
}
Provided Methods§
Sourcefn server_name(&self) -> String
fn server_name(&self) -> String
Optional: Custom server name (defaults to tool name)
Sourcefn server_version(&self) -> &'static str
fn server_version(&self) -> &'static str
Optional: Server version (defaults to “0.0.1”)
Sourcefn capabilities(&self) -> Value
fn capabilities(&self) -> Value
Optional: Additional server capabilities
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.