tools.md 3.8 KB

Tools & Capabilities

Built-in tools available to agents beyond the standard file and shell operations.

apply_patch rescue

Slim only intercepts apply_patch before the native tool runs. It rewrites recoverable stale patches, canonizes safe tolerant matches against the real file when unicode/trim drift is the only mismatch, keeps the authored new_lines bytes intact, preserves the existing file EOL/final-newline state for updates, validates malformed patches strictly before helper execution, uses a conservative bounded LCS fallback, accumulates helper state when the same path appears in multiple Update File hunks, blocks apply_patch before native execution if any patch path falls outside the allowed root/worktree, and fails on ambiguity instead of guessing. It does not rewrite edit or write inputs.


Web Fetch

Fetch remote pages with content extraction tuned for docs/static sites.

Tool Description
webfetch Fetch a URL, optionally prefer llms.txt, extract main content from HTML, include metadata, and optionally save binary responses

webfetch blocks cross-origin redirects unless the requested URL or derived permission patterns explicitly allow them, and it can fall back to the raw fetched content when secondary-model summarization is unavailable.


Code Search Tools

Fast, structural code search and refactoring - more powerful than plain text grep.

Tool Description
grep Fast content search using ripgrep
ast_grep_search AST-aware code pattern matching across 25 languages
ast_grep_replace AST-aware code refactoring with dry-run support

ast_grep understands code structure, so it can find patterns like "all arrow functions that return a JSX element" rather than relying on exact text matching.


Background Task Control

Tool Description
cancel_task Cancel a tracked background specialist task by native task ID or Background Job Board alias
reconcile_task Mark a terminal (completed/error/cancelled) background task as reconciled so it no longer appears as unreconciled
wait_for_user Pause automatic incomplete-todo continuation until the next distinct external user message

cancel_task is orchestrator-only. It only cancels background tasks tracked for the current orchestrator session, and it does not roll back partial edits. After cancelling a write-capable task, inspect and reconcile file changes before launching replacement work.

reconcile_task is orchestrator-only. It marks a terminal task as reconciled in the Background Job Board without invoking any specialist session. This is a state-only operation — use it before final response when a terminal result has been received and consumed. Idle-based auto-reconciliation also handles this when the orchestrator session goes idle.

wait_for_user is also orchestrator-only. The orchestrator uses it as the final tool action after providing concrete instructions for external manual work. Its reason is diagnostic text only; the plugin does not parse assistant prose to decide whether a turn is HITL. A new real user text/file/image message clears the wait. Synthetic/internal messages and duplicate delivery of the user message that preceded the wait do not.

See the background orchestration concepts in Background Orchestration for the session lifecycle, cancellation, and explicit-wait edge cases behind these tools.


Formatters

OpenCode automatically formats files after they are written or edited, using language-specific formatters. No manual step needed.

Includes Prettier, Biome, gofmt, rustfmt, ruff, and 20+ others.

See the official OpenCode docs for the complete list.