pub struct ExternalTool {
pub name: String,
pub description: String,
pub parameters: Value,
pub is_final: bool,
pub prompt: Option<String>,
}Expand description
External tool that delegates execution to the frontend
Fields§
§name: String§description: String§parameters: Value§is_final: bool§prompt: Option<String>Detailed usage instructions injected into the system prompt.
Trait Implementations§
Source§impl Clone for ExternalTool
impl Clone for ExternalTool
Source§fn clone(&self) -> ExternalTool
fn clone(&self) -> ExternalTool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ComposeSchema for ExternalTool
impl ComposeSchema for ExternalTool
Source§impl Debug for ExternalTool
impl Debug for ExternalTool
Source§impl<'de> Deserialize<'de> for ExternalTool
impl<'de> Deserialize<'de> for ExternalTool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for ExternalTool
impl JsonSchema for ExternalTool
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ExternalTool
impl PartialEq for ExternalTool
Source§impl Serialize for ExternalTool
impl Serialize for ExternalTool
Source§impl ToSchema for ExternalTool
impl ToSchema for ExternalTool
Source§impl Tool for ExternalTool
impl Tool for ExternalTool
fn get_name(&self) -> String
fn get_description(&self) -> String
fn get_parameters(&self) -> Value
Source§fn is_external(&self) -> bool
fn is_external(&self) -> bool
Check if this tool is external (handled by frontend)
fn is_final(&self) -> bool
Source§fn prompt(&self) -> Option<String>
fn prompt(&self) -> Option<String>
Optional detailed prompt/instructions for this tool.
When provided, these instructions are injected into the system prompt
so the LLM knows HOW to use the tool (not just what parameters it takes).
This mirrors claude-code’s per-tool
prompt() pattern.Source§fn execute<'life0, 'async_trait>(
&'life0 self,
_tool_call: ToolCall,
_context: Arc<ToolContext>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Part>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
_tool_call: ToolCall,
_context: Arc<ToolContext>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Part>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with given arguments, returning content parts
Source§fn get_tool_definition(&self) -> ToolDefinition
fn get_tool_definition(&self) -> ToolDefinition
Get the tool definition for the LLM
fn get_tool_examples(&self) -> Option<String>
fn is_sync(&self) -> bool
Source§fn needs_executor_context(&self) -> bool
fn needs_executor_context(&self) -> bool
Check if this tool needs ExecutorContext instead of ToolContext
Source§fn get_auth_metadata(&self) -> Option<Box<dyn AuthMetadata>>
fn get_auth_metadata(&self) -> Option<Box<dyn AuthMetadata>>
Get authentication metadata for this tool
Source§fn get_plugin_name(&self) -> Option<String>
fn get_plugin_name(&self) -> Option<String>
Get the plugin name this tool belongs to (nullable)
If this returns Some, the tool is part of a plugin
If None, the tool is standalone
Source§fn execute_sync(
&self,
_tool_call: ToolCall,
_context: Arc<ToolContext>,
) -> Result<Vec<Part>, Error>
fn execute_sync( &self, _tool_call: ToolCall, _context: Arc<ToolContext>, ) -> Result<Vec<Part>, Error>
Synchronous execution of the tool, returning content parts (default unsupported)
impl StructuralPartialEq for ExternalTool
Auto Trait Implementations§
impl Freeze for ExternalTool
impl RefUnwindSafe for ExternalTool
impl Send for ExternalTool
impl Sync for ExternalTool
impl Unpin for ExternalTool
impl UnsafeUnpin for ExternalTool
impl UnwindSafe for ExternalTool
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