pub struct CtxShapeTool;Expand description
Shapes the output of a host-native tool after it ran (concept K2,
“shape, don’t redirect”): a host mod (Claude Code tool.call) forwards the
native Bash stdout here instead of denying the call and forcing a round
trip to ctx_shell. The text it rewrites gets lean-ctx’s secret redaction,
and the result flows through the same dispatch pipeline as every ctx_*
output (sensitivity floor, policy-pack redaction, input filters).
Host-only surface: a host extension calls it through ctx_call ($.mcp.call
in Claude Code 2.1.296+ only reaches listed tools, #2089); it is never
advertised, and every gate refusal on it is an error so the host keeps the
native output — see dynamic_tools::INTERNAL_HOST_TOOLS.
Trait Implementations§
Source§impl McpTool for CtxShapeTool
impl McpTool for CtxShapeTool
Source§fn produces_machine_readable(&self, _args: Option<&Map<String, Value>>) -> bool
fn produces_machine_readable(&self, _args: Option<&Map<String, Value>>) -> bool
The body replaces a native tool’s output verbatim, so the pipeline must hand it back without hints, nudges or checkpoints — after its redaction, sensitivity and filter passes, which machine-readable calls keep.
Source§fn tool_def(&self) -> Tool
fn tool_def(&self) -> Tool
granular_tool_defs().Source§fn handle(
&self,
args: &Map<String, Value>,
_ctx: &ToolContext,
) -> Result<ToolOutput, ErrorData>
fn handle( &self, args: &Map<String, Value>, _ctx: &ToolContext, ) -> Result<ToolOutput, ErrorData>
ctx provides access to resolved paths and project state.Source§fn rights_name(&self) -> &'static str
fn rights_name(&self) -> &'static str
denied_tools (process-v1 §9): an alias names the tool it delegates
to, so denying that tool denies every name it is reachable under.Source§fn attests_source_free(&self, _args: Option<&Map<String, Value>>) -> bool
fn attests_source_free(&self, _args: Option<&Map<String, Value>>) -> bool
false: “no source was
observed” is not proof, an uninstrumented reader publishes none either.
Override only for a tool whose handler was read for exactly this.Source§fn publishes_every_source(&self, _args: Option<&Map<String, Value>>) -> bool
fn publishes_every_source(&self, _args: Option<&Map<String, Value>>) -> bool
tools::ctx_read::read_file_*), on the handler’s own thread or on
workers started with TaskSpine::spawn_thread — so that each of them is
published into the call’s source capture. Only then is a captured
source set the WHOLE set, and only then may it authorize reuse of the
result (idempotent replay, response cache, source-bound recovery copy). Read moreAuto Trait Implementations§
impl Forget for CtxShapeTool
impl Freeze for CtxShapeTool
impl Move for CtxShapeTool
impl RefUnwindSafe for CtxShapeTool
impl Send for CtxShapeTool
impl Sync for CtxShapeTool
impl Unpin for CtxShapeTool
impl UnsafeUnpin for CtxShapeTool
impl UnwindSafe for CtxShapeTool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more