Skip to main content

Module tool_trait

Module tool_trait 

Source

Structs§

ToolContext
Context passed to tool handlers. Contains pre-resolved values that many tools need, avoiding repeated async lock acquisition inside handlers. Extended with shared server state for tools that need cache/session access.
ToolOutput
Result returned by an McpTool handler.

Enums§

ShellOutcome
Outcome of a shell execution, carried alongside the rendered text so the MCP dispatch layer can surface failures in protocol metadata instead of only as an [exit:N] text footer (GitHub #389: clients had no programmatic way to detect ctx_shell failures and resorted to fragile regex matching).

Traits§

McpTool
Trait for a self-contained MCP tool. Each tool provides its own schema definition and handler, eliminating the possibility of schema/handler drift.

Functions§

get_bool
get_f64
get_int
get_str
get_str_array
get_usize
Read a non-negative integer argument as usize.
require_resolved_path
Extract a resolved path from context with differentiated error messages. Returns descriptive errors for: missing param, PathJail rejection, wrong type.