Skip to main content

tool_from_descriptor

Function tool_from_descriptor 

Source
pub fn tool_from_descriptor(
    name: impl Into<Cow<'static, str>>,
    description: Option<String>,
    input_schema: Option<Value>,
    output_schema: Option<Value>,
    destructive: bool,
) -> Tool
Expand description

Build an [rmcp::model::Tool] from loose descriptor fields, defaulting a missing or non-object input schema to an empty JSON object schema and dropping a non-object output schema rather than failing.

Unlike tool_from_json_definition, this never fails — it is meant for building tools from already-typed route/descriptor structs (upstream catalogs, gateway routes) where a malformed schema is a data-quality issue upstream, not a reason to drop the whole tool.