Skip to main content

ToolCallResult

Struct ToolCallResult 

Source
pub struct ToolCallResult {
    pub content: Vec<ContentItem>,
    pub is_error: Option<bool>,
}
Expand description

What a tools/call returns: the text a model will read.

Every handler in crate::context produces one of these, and the renderers in crate::render decide what goes in it — the text IS the API (each experiment-pool result ends with a next: line and carries its run_dir:), so this type stays a thin envelope.

Fields§

§content: Vec<ContentItem>

The content items, concatenated by content_text when a caller wants the single string a model sees.

§is_error: Option<bool>

Some(true) when the tool failed. MCP keeps tool failure inside a successful response — the model reads the error text and can react to it, unlike a protocol-level JsonRpcError.

Implementations§

Source§

impl ToolCallResult

Source

pub fn text(s: impl Into<String>) -> Self

A successful result carrying one text block.

Source

pub fn error(s: impl Into<String>) -> Self

A failed result: the same text block, flagged isError so the model knows it is reading a failure, not an answer.

Source

pub fn content_text(&self) -> String

The text a model would see — every content item concatenated. The protocol carries text, so this is the whole result.

Source

pub fn is_error(&self) -> bool

Whether this result is an error; an absent flag means success.

Trait Implementations§

Source§

impl Debug for ToolCallResult

Source§

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

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

impl Serialize for ToolCallResult

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::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
§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

The receiver as &dyn Any, ready for downcast_ref.
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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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