Skip to main content

ToolEnvelope

Struct ToolEnvelope 

Source
pub struct ToolEnvelope {
    pub exit_code: Option<i32>,
    pub stdout: Option<String>,
    pub stderr: Option<String>,
    pub timed_out: Option<bool>,
    pub stdout_truncated: bool,
    pub stderr_truncated: bool,
    pub denied: bool,
    pub denials: Vec<Denial>,
    pub sandbox_kind: SandboxKind,
    pub enforcement: EnforcementReport,
    pub disclosure: Disclosure,
}
Expand description

A structured execution result. Serialized to the MCP content shape via ToolEnvelope::into_json; absent fields are omitted.

Fields§

§exit_code: Option<i32>

Process exit code, when the operation had one.

§stdout: Option<String>

Captured standard output, when relevant.

§stderr: Option<String>

Captured standard error, when relevant.

§timed_out: Option<bool>

Whether the operation was cut short by a timeout.

§stdout_truncated: bool

Whether captured stdout was clipped at the output cap (more was produced than was kept). Lets a consumer tell a complete result from a truncated one. Omitted (treated as false) when output was not clipped.

§stderr_truncated: bool

Whether captured stderr was clipped at the output cap. Omitted when not.

§denied: bool

Whether the in-process leash recorded at least one denial during this invocation. This is a structured signal: it is set iff Self::denials is non-empty, so a consumer never has to string-match stderr to detect a security refusal. Omitted (treated as false) when no denial was recorded.

§denials: Vec<Denial>

The denials the interceptor recorded, in the order they occurred. Empty (and omitted from JSON) unless Self::denied is true.

§sandbox_kind: SandboxKind

The OS-level sandbox in force when this ran. Always present so callers can tell whether the leash was kernel-enforced or advisory.

§enforcement: EnforcementReport

Per-axis confinement report (ADR 0004 D1): for each restricted axis, whether it is kernel / interceptor / advisory. Refines the coarse sandbox_kind (which stays the minimum claim) at axis grain. Omitted from JSON when no axis is restricted.

§disclosure: Disclosure

Operator-facing disclosure (ADR 0017 D6) — informational only, never part of the enforcement claim. Quiet by default (omitted when nothing is worth disclosing); an unbridled run always surfaces here.

Implementations§

Source§

impl ToolEnvelope

Source

pub fn new(sandbox_kind: SandboxKind) -> ToolEnvelope

An envelope stamped with the sandbox kind and nothing else set.

Source

pub fn with_exit_code(self, code: i32) -> ToolEnvelope

Set the exit code (builder style).

Source

pub fn with_stdout(self, stdout: impl Into<String>) -> ToolEnvelope

Set captured stdout (builder style).

Source

pub fn with_stderr(self, stderr: impl Into<String>) -> ToolEnvelope

Set captured stderr (builder style).

Source

pub fn with_timed_out(self, timed_out: bool) -> ToolEnvelope

Mark whether the operation timed out (builder style).

Source

pub fn with_truncation( self, stdout_truncated: bool, stderr_truncated: bool, ) -> ToolEnvelope

Mark whether captured stdout/stderr were clipped at the cap (builder style). A truncated stream is a bounded read: peak buffering never exceeds the cap regardless of how much the child produced.

Source

pub fn with_denials(self, denials: Vec<Denial>) -> ToolEnvelope

Attach the leash denials the interceptor recorded (builder style).

Self::denied is set to true iff denials is non-empty, so the boolean flag and the list can never disagree. Passing an empty vec is a no-op (the result stays un-denied), which keeps the common nothing-was-denied path clean.

Source

pub fn with_enforcement(self, enforcement: EnforcementReport) -> ToolEnvelope

Attach the per-axis confinement report (builder style; ADR 0004 D1).

Source

pub fn with_disclosure(self, disclosure: Disclosure) -> ToolEnvelope

Attach the operator-facing disclosure (builder style; ADR 0017 D6). Purely informational — it does not affect Self::enforcement, Self::sandbox_kind, or any confinement claim.

Source

pub fn into_json(self) -> Value

Serialize to the JSON content shape tools return.

§Panics

Never in practice: the envelope contains only JSON-representable scalars.

Trait Implementations§

Source§

impl Clone for ToolEnvelope

Source§

fn clone(&self) -> ToolEnvelope

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ToolEnvelope

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ToolEnvelope

Source§

fn default() -> ToolEnvelope

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ToolEnvelope

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ToolEnvelope, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ToolEnvelope

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, T> ConvertInto<T> for F
where T: ConvertFrom<F>,

Source§

fn convert_into(self) -> T

Infallibly converts a value of type Self to a value of type T.
Source§

impl<F, T> ConvertTryFrom<F> for T
where F: ConvertInto<T>,

Source§

type Error = !

The type of an error that can occur during a conversion. Read more
Source§

fn convert_try_from(value: F) -> Result<T, !>

Fallibly converts a value of type F to a value of type Self.
Source§

impl<F, T> ConvertTryInto<T> for F
where T: ConvertTryFrom<F>,

Source§

type Error = <T as ConvertTryFrom<F>>::Error

The type of an error that can occur during a conversion. Read more
Source§

fn convert_try_into(self) -> Result<T, <T as ConvertTryFrom<F>>::Error>

Fallibly converts a value of type Self to a value of type T.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more