pub struct WriteTool { /* private fields */ }Expand description
Agent tool that writes UTF-8 file contents under the mutation queue.
Implementations§
Source§impl WriteTool
impl WriteTool
Sourcepub fn with_options(options: WriteToolOptions) -> Self
pub fn with_options(options: WriteToolOptions) -> Self
Creates a write tool from explicit options.
Sourcepub fn parameters_schema() -> Value
pub fn parameters_schema() -> Value
Returns the JSON Schema for write arguments (normalized TypeBox shape).
Sourcepub fn parse_input(
args: &Map<String, Value>,
) -> Result<WriteToolInput, ToolError>
pub fn parse_input( args: &Map<String, Value>, ) -> Result<WriteToolInput, ToolError>
Validates raw tool arguments into WriteToolInput.
§Errors
Returns ToolError when required fields are missing or mistyped.
Sourcepub fn utf16_length(content: &str) -> usize
pub fn utf16_length(content: &str) -> usize
JS String.prototype.length (UTF-16 code units).
Sourcepub fn success_text(path: &str, content: &str) -> String
pub fn success_text(path: &str, content: &str) -> String
Formats the success text using the caller’s path string and JS length.
Trait Implementations§
Source§impl AgentTool for WriteTool
impl AgentTool for WriteTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable tool description.
Source§fn parameters(&self) -> &Value
fn parameters(&self) -> &Value
JSON Schema for tool arguments.
Source§fn validate_arguments(
&self,
args: &Map<String, Value>,
) -> Result<Map<String, Value>, ToolError>
fn validate_arguments( &self, args: &Map<String, Value>, ) -> Result<Map<String, Value>, ToolError>
Validates prepared arguments for this tool. Read more
Source§fn execute(
&self,
_tool_call_id: &str,
args: Map<String, Value>,
cancel: CancellationToken,
_updates: ToolUpdates,
) -> BoxFuture<'static, Result<AgentToolResult, ToolError>>
fn execute( &self, _tool_call_id: &str, args: Map<String, Value>, cancel: CancellationToken, _updates: ToolUpdates, ) -> BoxFuture<'static, Result<AgentToolResult, ToolError>>
Executes the tool call. Read more
Source§fn execution_mode(&self) -> Option<ToolExecutionMode>
fn execution_mode(&self) -> Option<ToolExecutionMode>
Optional per-tool execution mode override. Read more
Auto Trait Implementations§
impl Freeze for WriteTool
impl RefUnwindSafe for WriteTool
impl Send for WriteTool
impl Sync for WriteTool
impl Unpin for WriteTool
impl UnsafeUnpin for WriteTool
impl UnwindSafe for WriteTool
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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 moreCreates a shared type from an unshared type.