Skip to main content

McpToolInput

Trait McpToolInput 

Source
pub trait McpToolInput: Sized {
    // Required methods
    fn input_schema() -> McpSchema;
    fn from_tool_call(call: McpToolCall) -> Result<Self, McpToolError>;
}
Expand description

Typed MCP tool input decoded from a protocol argument object.

Derive this on app-owned form submit or table query argument structs when a generated integration should publish the JSON schema and pass a typed value to the tool handler. Field schemas and decoders are paired through McpToolValue. The derive also implements McpJsonSchema for the input struct, so object-shaped tool inputs can be reused as nested field or filter values.

Required Methods§

Source

fn input_schema() -> McpSchema

Returns the input object’s JSON Schema.

Source

fn from_tool_call(call: McpToolCall) -> Result<Self, McpToolError>

Decodes a normalized tool call into this input type.

§Errors

Returns McpToolError when required fields are missing, unknown fields remain, a field value fails schema validation, or serde rejects a field.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl McpToolInput for ()

Implementors§