Skip to main content
Available now

Search, understand, and modify code with approvals

Reader tools for scoped code search and file inspection. Writer tools with approval gates for safe patch proposals and automated refactoring.

What Code Tools do

Code Tools let you search, read, and understand codebases programmatically. Writer tools propose patches and refactorings that pause for your approval before applying. Evaluation hooks run unit tests to verify changes before they're finalized.

Reader capabilities

  • Scoped code search with regex and semantic hints
  • File read with syntax highlighting and line numbers
  • Symbol listing (functions, classes, imports)

Writer capabilities Gated

  • Propose patches with diff preview (requires approval)
  • Format code and apply style fixes (gated)
  • Trigger evaluation test runs for verification
Safe by default: No writes without approval. All patches are previewed as diffs before applying. Path allowlists prevent accidental modifications outside your project.

Who benefits from Code Tools

Individuals

Quick refactors with guardrails—preview diffs before applying

Example: "Add input validation to this function" — see the proposed patch, approve it, and run tests to confirm it works.

Teams & Managers

Repeatable code maintenance workflows with diff approvals

Example: Standardize error handling across modules—review each patch, approve, and track changes in audit logs.

Developers & IT

Structured patch proposals and CI-friendly outputs

Example: Integrate code tools into CI/CD to propose automated fixes that developers review and merge.

Security & Compliance

Write gates, diffs, and logs of every change

Control: Require approval for all code writes. Audit logs show who approved what and when.

How it works

1

Read: Locate and display code

Use code.search to find files or symbols, then code.read_file to inspect contents.

2

Propose: Generate diff

Call code.propose_patch with the desired changes. The orchestrator pauses and shows you a diff preview.

3

Approve: Review and consent

You review the diff and approve or reject. Only approved patches are applied.

4

Verify: Run tests

Trigger eval.run_unit_tests to confirm the patch doesn't break existing functionality.

Safety & approvals: All writes are gated. Patches are scoped to allowlisted directories. Max diff size limits prevent accidental large-scale changes.

Example workflows

Add input validation + tests

Approval required
Input:

"Add input validation to the user registration module and write unit tests"

Steps:
  1. code.search (locate registration module)
  2. code.propose_patch (add validation logic) — pauses for approval
  3. eval.run_unit_tests (stub tests to confirm structure)
Output:

Diff preview, approval timestamp, test results, and audit log entry

Grep-like code search

Read-only
Input:

"Find all functions that call the deprecated API"

Steps:
  1. code.search (regex: "deprecatedAPI\(")
  2. Return list of files and line numbers
Output:

List of matches with file paths, line numbers, and surrounding context

Automated style fixes

Approval required
Input:

"Format all TypeScript files in src/ with Prettier"

Steps:
  1. code.search (find all .ts files in src/)
  2. code.propose_patch (apply formatting) — pauses for approval
  3. Apply changes after approval
Output:

Formatted files with diff summary and approval log

Technical details

Key tools

  • code.search
  • code.read_file
  • code.list_symbols
  • code.propose_patch (gated)
  • code.format (gated)
View tool schemas

Configuration

  • CODE_WRITE_ENABLE — false (default)
  • PATH_ALLOWLIST — scoped directories
  • MAX_DIFF_SIZE — lines per patch
  • SEARCH_TIMEOUT — max search duration

Performance notes

  • Search: typically 100-500ms for medium codebases
  • Patch generation: 1-3 seconds depending on complexity
  • Test runs: depends on test suite size

Observability

  • Patch counts and approval latency
  • Test outcomes (pass/fail/skip)
  • Search query performance
  • Write rejection counters

Security posture

No writes without approval

All patch proposals pause for explicit consent. Diffs are previewed before applying.

Path allowlists

Writes are scoped to allowlisted directories. Attempts to modify files outside the allowlist are rejected.

Audit logs

Every search, read, and write is logged with timestamps and approval decisions.

Max diff size limits

Patches exceeding the max diff size are rejected to prevent accidental large-scale changes.

Roadmap & status

Available

Current features

  • Code search and file reading
  • Patch proposals with diff preview
  • Evaluation hooks for test runs
Planned

Coming soon

  • Containerized build and test environments
  • Repo federation for remote code access
  • Advanced refactoring primitives
View full roadmap

Frequently asked questions

Ready to refactor safely?

Install MCP and start proposing code changes with approval gates and audit logs