Skip to main content

tool_definition

Function tool_definition 

Source
pub fn tool_definition<A: JsonSchema>(
    name: String,
    description: String,
) -> FunctionDefinition
Expand description

Builds a strict FunctionDefinition from a typed argument schema.

The parameter schema is derived from A via gen_schema_for, so the argument struct (doc comments, #[schemars(...)] attributes) is the single source of truth for the wire schema. Tools whose schema has instance-dependent parts mutate parameters on the returned definition.