pub struct ToolDefinition {
pub name: ToolName,
pub description: String,
pub parameters: Value,
pub output_schema: Option<Value>,
}Expand description
Minimal tool definition passed to LLM providers.
Decoupled from zeph-tools::ToolDef to avoid cross-crate dependencies.
Providers translate this into their native tool/function format before sending to the API.
§Examples
use zeph_common::types::ToolDefinition;
use zeph_common::ToolName;
let tool = ToolDefinition {
name: ToolName::new("get_weather"),
description: "Return current weather for a city.".into(),
parameters: serde_json::json!({
"type": "object",
"properties": {
"city": { "type": "string" }
},
"required": ["city"]
}),
output_schema: None,
};
assert_eq!(tool.name, "get_weather");Fields§
§name: ToolNameTool name — must match the name used in the response ToolUseRequest.
description: StringHuman-readable description guiding the model on when to call this tool.
parameters: ValueJSON Schema object describing parameters.
output_schema: Option<Value>Raw output schema advertised by the MCP server, if present.
When mcp.forward_output_schema = true, LLM provider assemblers append a compact JSON
hint to the tool description rather than adding a new top-level field (unsupported by
the Anthropic and OpenAI APIs).
DO NOT convert to schemars::Schema — lossy; see #2931 critique P0-1.
Trait Implementations§
Source§impl Clone for ToolDefinition
impl Clone for ToolDefinition
Source§fn clone(&self) -> ToolDefinition
fn clone(&self) -> ToolDefinition
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 Debug for ToolDefinition
impl Debug for ToolDefinition
Source§impl Default for ToolDefinition
impl Default for ToolDefinition
Source§fn default() -> ToolDefinition
fn default() -> ToolDefinition
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ToolDefinition
impl<'de> Deserialize<'de> for ToolDefinition
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
Auto Trait Implementations§
impl Freeze for ToolDefinition
impl RefUnwindSafe for ToolDefinition
impl Send for ToolDefinition
impl Sync for ToolDefinition
impl Unpin for ToolDefinition
impl UnsafeUnpin for ToolDefinition
impl UnwindSafe for ToolDefinition
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