pub struct TodoWriteTool { /* private fields */ }Expand description
ToolExecutor for todo_write (#8235).
Why: see module docs.
What: holds the TodoStore the run’s registry was built with; execute
validates then writes, and every failure path returns a recoverable
ToolResult::err — never a panic, never a success over an unchanged list.
Test: tests::*.
Implementations§
Trait Implementations§
Source§impl ToolExecutor for TodoWriteTool
impl ToolExecutor for TodoWriteTool
Source§fn schema(&self) -> Value
fn schema(&self) -> Value
JSON schema for todo_write.
Why: the description is the only place the model reliably reads about
this tool — task::executor’s delegating path scopes the system
prompt to the agent card’s own tcode_tools and this tool is not one
of them, exactly as set_goal/clear_goal are not. So the “when to
use it” rule lives here, kept to three sentences.
What: todos (array of {content, status}, required). status is
declared as an enum for the model’s benefit; parse_todos re-checks
it, because a loose schema validator accepting a bad value must still
produce an indexed refusal rather than a serde error.
Test: tests::schema_declares_todos_and_the_three_statuses.
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Validate the model’s whole list, then replace the stored one.
Why: ordered validate-then-write so no refusal can leave a partially
applied list behind — #8235’s fail-open check.
What: a malformed argument shape, any TodoError from
[parse_todos], and a store refusal each become a recoverable
ToolResult::err carrying the model-actionable text.
Test: tests::valid_call_reaches_the_store,
tests::rejected_call_never_reaches_the_store,
tests::malformed_args_are_a_recoverable_error,
tests::store_failure_is_a_recoverable_tool_error.
Source§fn restricted_tiers(&self) -> &[ServiceTier]
fn restricted_tiers(&self) -> &[ServiceTier]
Auto Trait Implementations§
impl !RefUnwindSafe for TodoWriteTool
impl !UnwindSafe for TodoWriteTool
impl Freeze for TodoWriteTool
impl Send for TodoWriteTool
impl Sync for TodoWriteTool
impl Unpin for TodoWriteTool
impl UnsafeUnpin for TodoWriteTool
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
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