Skip to main content

Module tool_trait

Module tool_trait 

Source

Structs§

BackgroundDisplay
BackgroundLookupError
A background job lookup failed without evidence of a lifecycle state.
BackgroundShellOutcome
Protocol metadata that must survive output compression and archiving.
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§

BackgroundJobState
Stable states exposed by ctx_shell(background_action="status").
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).

Constants§

PATH_LIKE_KEYS
Path arguments shared by MCP dispatch and the embedded Engine boundary.
TOOL_EXECUTION_ERROR
Internal handler-to-dispatch signal for an executed operation that failed. Unlike invalid arguments, its body can contain file excerpts and must pass the full content pipeline before becoming an MCP isError result.

Statics§

REQUEST_CT
#1781: the cancellation token of the request currently being served, scoped by call_tool around the whole guarded dispatch.

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.