pub struct JsReplTool;Expand description
JavaScript REPL tool — executes JavaScript code using Node.js.
Uses a fresh Node.js subprocess per invocation. The code is piped to
node --input-type=module on stdin so multi-line programs and await
at the top level are supported.
Inspired by Codex’s js_repl tool but uses a simpler sub-process model
rather than a persistent kernel.
Implementations§
Source§impl JsReplTool
impl JsReplTool
Trait Implementations§
Source§impl Default for JsReplTool
impl Default for JsReplTool
Source§impl Tool for JsReplTool
impl Tool for JsReplTool
fn name(&self) -> &str
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable tool description for LLM.
Source§fn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
JSON Schema for tool parameters.
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with given arguments.
Source§fn mutability(&self) -> ToolMutability
fn mutability(&self) -> ToolMutability
Declares whether this tool is read-only or mutating for orchestration and
parallel scheduling decisions. Defaults to mutating to stay conservative.
Source§fn call_mutability(&self, _args: &Value) -> ToolMutability
fn call_mutability(&self, _args: &Value) -> ToolMutability
Args-aware mutability hook. Defaults to the static mutability declaration.
Source§fn concurrency_safe(&self) -> bool
fn concurrency_safe(&self) -> bool
Declares whether this tool can safely run in parallel with other
read-only tools. Defaults to false so tools remain serialized unless
they opt in explicitly.
Source§fn call_concurrency_safe(&self, _args: &Value) -> bool
fn call_concurrency_safe(&self, _args: &Value) -> bool
Args-aware parallel-safety hook. Defaults to the static declaration.
Source§fn execute_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
_ctx: ToolExecutionContext<'life1>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn execute_with_context<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
_ctx: ToolExecutionContext<'life1>,
) -> Pin<Box<dyn Future<Output = Result<ToolResult, ToolError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Execute the tool with a streaming-capable context. Read more
Source§fn to_schema(&self) -> ToolSchema
fn to_schema(&self) -> ToolSchema
Convert tool to LLM-compatible schema. Read more
Auto Trait Implementations§
impl Freeze for JsReplTool
impl RefUnwindSafe for JsReplTool
impl Send for JsReplTool
impl Sync for JsReplTool
impl Unpin for JsReplTool
impl UnsafeUnpin for JsReplTool
impl UnwindSafe for JsReplTool
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