Skip to main content

StaticTool

Trait StaticTool 

Source
pub trait StaticTool:
    Send
    + Sync
    + 'static {
    type Params: DeserializeOwned + JsonSchema + Send;
    type Output: Into<ToolResult> + Send;
    type Spec: ToolSpec<Params = Self::Params, Result = Self::Output>;

    const DESCRIPTION: &'static str;
    const REQUIRES_APPROVAL: bool;
    const REQUIRED_CAPABILITIES: Capabilities;

    // Required method
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        params: Self::Params,
        ctx: &'life1 StaticToolContext,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, StaticToolError<<Self::Spec as ToolSpec>::Error>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn schema() -> ToolSchema
       where Self: Sized { ... }
}

Required Associated Constants§

Required Associated Types§

Required Methods§

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, params: Self::Params, ctx: &'life1 StaticToolContext, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, StaticToolError<<Self::Spec as ToolSpec>::Error>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn schema() -> ToolSchema
where Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl StaticTool for AstGrepTool

Source§

const DESCRIPTION: &'static str = r#"Structural code search using abstract syntax trees (AST). - Searches code by its syntactic structure, not just text patterns - Use $METAVAR placeholders (e.g., $VAR, $FUNC, $ARGS) to match any code element - Supports all major languages: rust, javascript, typescript, python, java, go, etc. Pattern examples: - "console.log($MSG)" - finds all console.log calls regardless of argument - "fn $NAME($PARAMS) { $BODY }" - finds all Rust function definitions - "if $COND { $THEN } else { $ELSE }" - finds all if-else statements - "import $WHAT from '$MODULE'" - finds all ES6 imports from specific modules - "$VAR = $VAR + $EXPR" - finds all self-incrementing assignments Advanced patterns: - "function $FUNC($$$ARGS) { $$$ }" - $$$ matches any number of elements - "foo($ARG, ...)" - ellipsis matches remaining arguments - Use any valid code as a pattern - ast-grep understands the syntax! Automatically respects .gitignore files"#

Source§

const REQUIRES_APPROVAL: bool = false

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = AstGrepParams

Source§

type Output = AstGrepResult

Source§

type Spec = AstGrepToolSpec

Source§

impl StaticTool for BashTool

Source§

const DESCRIPTION: &'static str = "Run a bash command in the terminal"

Source§

const REQUIRES_APPROVAL: bool = true

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = BashParams

Source§

type Output = BashResult

Source§

type Spec = BashToolSpec

Source§

impl StaticTool for DispatchAgentTool

Source§

const DESCRIPTION: &'static str = "Launch a sub-agent to search for files or code"

Source§

const REQUIRES_APPROVAL: bool = false

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::AGENT

Source§

type Params = DispatchAgentParams

Source§

type Output = AgentResult

Source§

type Spec = DispatchAgentToolSpec

Source§

impl StaticTool for EditTool

Source§

impl StaticTool for MultiEditTool

Source§

const DESCRIPTION: &'static str = "This is a tool for making multiple edits to a single file in one operation. Prefer this tool over the edit_file tool when you need to make multiple edits to the same file."

Source§

const REQUIRES_APPROVAL: bool = true

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = MultiEditParams

Source§

type Output = MultiEditResult

Source§

type Spec = MultiEditToolSpec

Source§

impl StaticTool for FetchTool

Source§

impl StaticTool for GlobTool

Source§

const DESCRIPTION: &'static str = r#"Fast file pattern matching tool that works with any codebase size. - Supports glob patterns like "**/*.js" or "src/**/*.ts" - Returns matching file paths sorted by modification time - Use this tool when you need to find files by name patterns"#

Source§

const REQUIRES_APPROVAL: bool = false

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = GlobParams

Source§

type Output = GlobResult

Source§

type Spec = GlobToolSpec

Source§

impl StaticTool for GrepTool

Source§

const DESCRIPTION: &'static str = r#"Fast content search built on ripgrep for blazing performance at any scale. - Searches using regular expressions or literal strings - Supports regex syntax like "log.*Error", "function\\s+\\w+", etc. - If the pattern isn't valid regex, it automatically searches for the literal text - Filter files by name pattern with include parameter (e.g., "*.js", "*.{ts,tsx}") - Automatically respects .gitignore files - Returns matches as "filepath:line_number: line_content""#

Source§

const REQUIRES_APPROVAL: bool = false

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = GrepParams

Source§

type Output = GrepResult

Source§

type Spec = GrepToolSpec

Source§

impl StaticTool for LsTool

Source§

const DESCRIPTION: &'static str = "Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You should generally prefer the Glob and Grep tools, if you know which directories to search."

Source§

const REQUIRES_APPROVAL: bool = false

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = LsParams

Source§

type Output = FileListResult

Source§

type Spec = LsToolSpec

Source§

impl StaticTool for ReplaceTool

Source§

const DESCRIPTION: &'static str = r"Writes a file to the local filesystem. Before using this tool: 1. Use the read_file tool to understand the file's contents and context 2. Directory Verification (only applicable when creating new files): - Use the ls tool to verify the parent directory exists and is the correct location"

Source§

const REQUIRES_APPROVAL: bool = true

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = ReplaceParams

Source§

type Output = ReplaceResult

Source§

type Spec = ReplaceToolSpec

Source§

impl StaticTool for TodoReadTool

Source§

impl StaticTool for TodoWriteTool

Source§

impl StaticTool for ViewTool

Source§

const DESCRIPTION: &'static str = "Reads a file from the local filesystem. The file_path parameter must be an absolute path, not a relative path.\nBy default, it reads up to 2000 lines starting from the beginning of the file. You can optionally specify a line offset and limit\n(especially handy for long files), but it\'s recommended to read the whole file by not providing these parameters.\nAny lines longer than 2000 characters will be truncated."

Source§

const REQUIRES_APPROVAL: bool = false

Source§

const REQUIRED_CAPABILITIES: Capabilities = Capabilities::WORKSPACE

Source§

type Params = ViewParams

Source§

type Output = FileContentResult

Source§

type Spec = ViewToolSpec