Skip to content

Agent Tools

term2 exposes a controlled set of tools to the agent, gated by the active profile and sandbox policies.

  • read_file: Reads file contents with support for line-number ranges (offset and limit) and size bounds.
  • apply_patch: Applies unified patches to files with preview and self-healing syntax recovery.
  • search_replace: Performs precise contiguous block replacements within a file.
  • create_file: Creates a new file in the workspace (or overwrites an existing file if explicitly approved).
  • glob: Finds files and directories using glob patterns (leveraging fd when installed).
  • grep: Performs regex or literal text searches across files (leveraging ripgrep when installed).
  • read_code_outline: Generates high-level symbol outlines (classes, functions, interfaces) for rapid file comprehension.
  • code_context_search: Searches code symbols and definitions across the codebase.
  • shell: Executes shell commands within the active sandbox policy. Commands that read or write outside approved boundaries prompt for explicit confirmation.
  • Background Shell Jobs: Long-running commands can run detached in the background:
    • get_shell_job: Check running state, exit codes, and output byte counts.
    • monitor_shell_job: Stream or fetch buffered output logs.
    • cancel_shell_job: Terminate background jobs gracefully or forcefully.
    • cancel_shell_monitor: Stop an output watch.
  • run_code: Executes JavaScript in a sandboxed V8 context directly inside the Node.js process.
  • Nested Tool Invocation: Inside a run_code script, the agent can call other tools programmatically via await tools.<toolName>(args).
  • Tool Approvals in Code: Nested read-only tool calls run automatically, while actions requiring approval prompt the user before continuing.
  • Script Isolation: Scripts execute in an isolated environment without access to process globals or host credentials.
  • JSON Inputs: Pass structured data separately from the script source with the inputs parameter; values are available through the script’s inputs binding.
  • Result Contracts: Scriptable tools expose a declarable return shape through describe, so a workflow can inspect the expected result before calling a tool.
  • Nested Trace: Tool calls made by a script are shown in the conversation and remain subject to the active approval policy.
  • ask_user: Asks clarifying questions to the user with an interactive prompt and selectable choices.
  • ask_mentor: Consults the higher-tier mentor model for architectural guidance or code review.
  • activate_skill: Loads specialized instruction sets and workflows for domain-specific tasks.
  • web_search: Search the web through the configured Tavily or Exa provider.
  • web_fetch: Fetch and extract content from a URL.