Struct ToolDefinition
pub struct ToolDefinition {
pub name: String,
pub description: String,
pub input_schema: Value,
}Expand description
What this server publishes, and what an agent consumes.
The same type either way: somatize_core::tool::ToolSpec. Soma is both
a tool provider (here) and a tool caller (soma-llm), and describing a
tool twice is how the two descriptions drift.
A tool’s name, purpose, and argument schema.
Fields§
§name: StringThe name a model calls it by — what [crate::effect::Effect::Tool]
and a [crate::message::ContentBlock::ToolUse] carry.
description: StringWhat it does — this is the text a model reads to decide whether to call it, so it is prompt, not documentation. Say when to use the tool, not only what it does: trigger conditions measurably raise the rate at which a model reaches for the right one.
input_schema: ValueJSON Schema for the arguments.
inputSchema on the wire (MCP’s spelling), input_schema also
accepted so hand-written JSON in either convention loads.
Implementations§
§impl ToolSpec
impl ToolSpec
pub fn new(
name: impl Into<String>,
description: impl Into<String>,
input_schema: Value,
) -> ToolSpec
pub fn new( name: impl Into<String>, description: impl Into<String>, input_schema: Value, ) -> ToolSpec
A fully described tool. For one with nothing to configure, see
Self::no_args.
pub fn no_args(
name: impl Into<String>,
description: impl Into<String>,
) -> ToolSpec
pub fn no_args( name: impl Into<String>, description: impl Into<String>, ) -> ToolSpec
A tool taking no arguments.
pub fn required_args(&self) -> Vec<&str>
pub fn required_args(&self) -> Vec<&str>
The argument names the schema marks required.