Tools Reference
Automergent exposes 36+ built-in tools organized by category. Each tool is self-documenting: the model receives its metadata, usage guidance, and examples automatically from the live registry. This page is a human-readable reference for all of them.
Filesystem Tools
read/editRead a file from disk, returning line-numbered content. Optionally bounded by start_line/end_line. Includes diagnostic headers when configured.
| Parameter | Type | Description |
|---|---|---|
| path | string required | Absolute or relative path to the file |
| start_line | integer | First line to read (1-based, inclusive) |
| end_line | integer | Last line to read (1-based, inclusive) |
read_file {"path": "internal/tools/tool.go", "start_line": 1, "end_line": 50}Write content to a file, creating it if needed. Uses atomic writes (temp file + rename) for crash safety. Validates against security policy and runs diagnostics pre-flight.
| Parameter | Type | Description |
|---|---|---|
| path | string required | File path to write |
| content | string required | Content to write |
write_file {"path": "README.md", "content": "# My Project\n\nDescription here."}Performs exact string replacement: old_str must match the file content exactly, once. The call fails if old_str is not unique unless replace_all is set. Runs diagnostics pre-flight to reject edits that introduce errors.
| Parameter | Type | Description |
|---|---|---|
| path | string required | File path to edit |
| old_str | string required | Exact string to replace |
| new_str | string required | Replacement string |
| replace_all | boolean | Replace all occurrences instead of first |
edit_file {"path": "main.go", "old_str": "func main() {", "new_str": "func main() {\n\tlog.SetFlags(0)"}Apply several exact string replacements to one file in a single call. Edits are applied sequentially, so later edits see earlier ones' output. One call replaces a noisy sequence of edit_file calls.
| Parameter | Type | Description |
|---|---|---|
| path | string required | File to edit |
| edits | array required | Array of {old_str, new_str, replace_all} objects |
multi_edit {"path": "server.go", "edits": [{"old_str": "port := 8080", "new_str": "port := 3000"}, {"old_str": "debug := true", "new_str": "debug := false"}]}Edit Jupyter notebook (.ipynb) cells in place: replace a cell's source, insert a new cell, or delete one. Cells are addressed by cell id or zero-based index. Preserves notebook metadata and outputs.
| Parameter | Type | Description |
|---|---|---|
| path | string required | Path to the .ipynb file |
| cell_id | string | Cell id (when notebook defines them) |
| cell_index | integer | Zero-based cell index |
| new_source | string | Full new source for the cell |
| cell_type | string | code or markdown (for insert mode) |
| edit_mode | string | replace, insert, or delete |
notebook_edit {"path": "analysis.ipynb", "cell_index": 2, "new_source": "import pandas as pd\ndf = pd.read_csv('data.csv')", "edit_mode": "replace"}Fast file pattern matching using glob patterns. Supports *, **, ?, and {a,b} alternatives. Skips node_modules, vendor, .git, __pycache__, .venv, venv automatically.
| Parameter | Type | Description |
|---|---|---|
| pattern | string required | Glob pattern (e.g., "**/*.go") |
| path | string | Directory to search (default: cwd) |
| max_results | integer | Max results (default: 1000) |
| include_hidden | boolean | Include hidden files (default: false) |
glob {"pattern": "**/*.go", "path": "internal/tools"}Search file contents using regular expressions. Supports full regex syntax, file pattern filtering, and returns file paths with line numbers and matching lines.
| Parameter | Type | Description |
|---|---|---|
| pattern | string required | Regex pattern to search for |
| include | string | File pattern filter (e.g., "*.go") |
| path | string | Directory to search in |
grep {"pattern": "func.*Execute", "include": "*.go", "path": "internal/tools"}List files and directories at a given path. Directories are suffixed with /. Simple and fast for exploring project structure.
| Parameter | Type | Description |
|---|---|---|
| path | string | Directory path to list (default: cwd) |
list_directory {"path": "src/"}Write a deliverable document (plan, review, design, summary, report) as a Markdown artifact file. Includes metadata the review UI needs and can request user feedback before continuing.
| Parameter | Type | Description |
|---|---|---|
| path | string required | File path (e.g., .automergent/artifacts/plan.md) |
| content | string required | Full Markdown content starting with # title |
| title | string | Short human title for the review list |
| kind | string | plan, review, design, summary, or document |
| request_feedback | boolean | True when user should review before continuing |
artifact {"path": ".automergent/artifacts/plan.md", "content": "# Migration Plan\n\nMigrate auth to JWT...", "title": "JWT Migration", "kind": "plan", "request_feedback": true}Shell Tools
shellExecute shell commands with sync or async support. Sync mode auto-backgrounds after 8s for long commands. Async mode returns a shell_id for read_shell/write_shell interaction. Supports detach for processes that survive session shutdown.
| Parameter | Type | Description |
|---|---|---|
| command | string required | Shell command to execute |
| mode | string | sync (default) or async |
| cwd | string | Working directory |
| timeout | string | Timeout for sync mode (e.g., "30s") |
| initial_wait | integer | Seconds to wait before auto-backgrounding |
| env | object | Additional environment variables |
| stdin | string | Input to send to stdin |
| detach | boolean | Process survives session shutdown |
| shell_id | string | Custom shell ID |
bash {"command": "go test ./internal/prompt/", "mode": "sync"}Read output from an async shell session. Returns stdout and stderr since last read. Shows completion status and exit code if finished. Large outputs are preserved to file.
| Parameter | Type | Description |
|---|---|---|
| shell_id | string required | Shell session ID from bash async |
| delay | integer | Seconds to wait before reading |
read_shell {"shell_id": "shell-3", "delay": 2}Send input to a running async shell session. Supports text and special keys: {enter}, {up}, {down}, {left}, {right}, {backspace}, {tab}, {escape}.
| Parameter | Type | Description |
|---|---|---|
| shell_id | string required | Shell session ID |
| input | string required | Input to send |
| delay | integer | Seconds to wait after sending |
Terminate a running async shell session. First cancels the context for graceful shutdown, then force-kills if still running. Cleans up session state.
| Parameter | Type | Description |
|---|---|---|
| shell_id | string required | Shell session ID to stop |
List shell sessions and background history. Shows status, duration, and truncated command for each session.
| Parameter | Type | Description |
|---|---|---|
| include_completed | boolean | Include completed sessions (default: true) |
Web Tools
webFetch the content of a web URL with strong SSRF protections. Validates DNS resolution, blocks private/local addresses, enforces content-type allowlists, and follows redirects with validation.
| Parameter | Type | Description |
|---|---|---|
| url | string required | URL to fetch (http/https only) |
web_fetch {"url": "https://pkg.go.dev/encoding/json"}Search the web via DuckDuckGo HTML. Returns parsed results with titles and links. Useful for finding documentation, solutions, or references.
| Parameter | Type | Description |
|---|---|---|
| query | string required | Search query |
web_search {"query": "Go context cancellation best practices"}Security Tools
securityScan files for hardcoded secrets, API keys, and credentials. Detects AWS, GitHub, GitLab, Google, Slack tokens, private keys, JWTs, Stripe, Twilio, SendGrid keys, database URLs, and generic API keys. Secrets are masked in output.
| Parameter | Type | Description |
|---|---|---|
| path | string | Directory or file to scan (default: cwd) |
| include_tests | boolean | Include test files (default: false) |
| exclude | array | Patterns to exclude |
secrets_scan {"path": "."}Audit dependencies for known vulnerabilities. Auto-detects package manager (go, npm, pip, cargo) and runs the appropriate tool (govulncheck, npm audit, pip-audit, cargo audit). Paths are sanitized in output.
| Parameter | Type | Description |
|---|---|---|
| path | string | Project directory (default: cwd) |
| framework | string | auto, go, npm, pip, or cargo |
dependency_audit {"path": ".", "framework": "go"}LSP / Diagnostics
lspGet compiler diagnostics for a Go file (package build errors) or lint findings for Python (via ruff). Reports real compiler output rather than unrelated test results. Includes recovery guidance for common errors.
| Parameter | Type | Description |
|---|---|---|
| file | string required | Path to a .go or .py source file |
lsp_diagnostics {"file": "internal/tools/tool.go"}Agent / Sub-agent Tools
agentsLaunch a specialized sub-agent for a task. Agent types include general-purpose, explore, review, code-review, contexter, coordinator, and task. Supports sync (blocking) and background (async) modes. Each sub-agent works independently with its own context.
| Parameter | Type | Description |
|---|---|---|
| agent_type | string required | Type of agent to spawn |
| prompt | string required | Task for the agent |
| name | string | Short name for the agent |
| description | string | Short description for UI |
| mode | string | sync or background |
| model | string | Optional model override |
| inherit_context | boolean | Fork conversation as context |
| resume_agent_id | string | Resume a previous agent |
task {"agent_type": "explore", "prompt": "Find all test files and summarize coverage", "mode": "sync"}Launch multiple sub-agents in parallel with a single call. Each agent runs independently on its own task. More efficient than calling task multiple times for independent work. Maximum 8 parallel tasks.
| Parameter | Type | Description |
|---|---|---|
| tasks | array required | Array of {agent_type, prompt, name, description, model} |
batch_task {"tasks": [{"agent_type": "explore", "prompt": "Find auth code"}, {"agent_type": "explore", "prompt": "Find test files"}]}Get results from a background agent. Use wait=true to block until completion. Supports since_turn to get only new turns in multi-turn agents.
| Parameter | Type | Description |
|---|---|---|
| agent_id | string required | Agent ID from task tool |
| wait | boolean | Wait for completion (default: false) |
| timeout | integer | Max seconds to wait (default: 10, max: 60) |
| since_turn | integer | Return only turns after this index |
List all agents with their status, type, and duration. Optionally include completed/failed agents.
| Parameter | Type | Description |
|---|---|---|
| include_completed | boolean | Include completed agents (default: true) |
Context & Planning
context/planningInspect your own context window state: token budget usage, the live conversation estimate, and what is consuming the window. Read-only; costs almost nothing.
Switch to plan mode: read-only analysis and planning; edits are refused. Use at the start of a non-trivial task that warrants a reviewed plan.
Present your plan for user approval and wait for their decision. Blocks until the user responds. On approval, plan mode ends and you may implement. On rejection, revise the plan and call again.
| Parameter | Type | Description |
|---|---|---|
| plan | string required | Short summary of the plan |
| plan_path | string | Path to plan artifact (default: .automergent/artifacts/plan.md) |
Verify that the executed plan's file changes are present. Reads the plan artifact, extracts file paths, and checks each against git's working-tree changes. Reports per-file evidence and an overall verdict.
| Parameter | Type | Description |
|---|---|---|
| plan_path | string | Path to plan artifact |
Interaction
interactionAsk the user one or more questions with optional multiple-choice options and get their answers. Supports structured questionnaires, timeout, and retry on empty responses. Blocks until user responds.
| Parameter | Type | Description |
|---|---|---|
| question | string | Single free-text question |
| questions | array | Structured questionnaire with options |
| timeout_secs | integer | Timeout in seconds |
| allow_empty | boolean | Allow empty responses (default: false) |
| max_attempts | integer | Max retry attempts (default: 3) |
Show a notification message to the user. Supports info, warning, and error levels. Rate-limited to prevent spam (default: 10 per minute).
| Parameter | Type | Description |
|---|---|---|
| message | string required | Message to display |
| title | string | Short title |
| level | string | info, warning, or error |
Skills
memoryList available skills with their descriptions. Skills are reusable, project-specific playbooks (SKILL.md files) covering how this repo does things. Optionally filter by query.
| Parameter | Type | Description |
|---|---|---|
| query | string | Optional filter by name or description |
Load a skill's instructions by name. Returns the full skill body; follow it inline for the rest of the task. Skills are re-read on every call for hot-reload support.
| Parameter | Type | Description |
|---|---|---|
| name | string required | Skill name (from discover_skills) |
Database
dbExecute SQL queries against the session SQLite database. Pre-built tables: todos, todo_deps, session_state. Supports SELECT, INSERT, UPDATE, DELETE. Includes SQL injection detection as defense-in-depth.
| Parameter | Type | Description |
|---|---|---|
| query | string required | SQL query to execute |
| description | string required | 2-5 word summary of the query |
| database | string | session or session_store |
sql {"query": "INSERT INTO todos (id, title, status) VALUES ('auth', 'Implement auth', 'pending')", "description": "Create auth todo"}MCP Resources
mcpList resources exposed by connected MCP servers. Resources are addressable data (files, schemas, records) that servers publish. Returns URI, server name, and description.
Read one MCP resource by URI. Returns the resource's text content. Resources can be large; prefer narrow URIs when available.
| Parameter | Type | Description |
|---|---|---|
| uri | string required | Resource URI from list_mcp_resources |
Policy
policyReport a policy violation (hacking, illegal acts, harmful code, credential theft, security bypass). Triggers escalation: warn (1st) → block_imminent (2nd) → blocked (3rd). User can override with valid justification.
| Parameter | Type | Description |
|---|---|---|
| type | string required | hacking, illegal, harmful_code, credential_theft, security_bypass |
| severity | string required | low, medium, high, critical |
| user_message | string required | The user's triggering message |
| agent_response | string required | Agent's response before detection |
| justification | string | User's justification for override |
Block the current session due to persistent policy violations. Use after violation_detected returns 'blocked' action.
| Parameter | Type | Description |
|---|---|---|
| reason | string required | Reason for blocking the session |
Override a violation detection with user justification (e.g., authorized security research, educational purpose). Resets violation count.
| Parameter | Type | Description |
|---|---|---|
| violation_type | string required | Type of violation to override |
| reason | string required | Justification for the override |