# apply_patch

Apply a unified diff / patch to a working directory using git apply (dry-run checked, paths validated, backups kept). Returns the resulting diff.

Agent View of the PolicyLayer registry record for `apply_patch`. HTML page: https://policylayer.com/tools/yuga-hashimoto-localant/apply-patch

## Facts

- Tool: `apply_patch`
- Server: LocalAnt (`yuga-hashimoto/localant`) — https://policylayer.com/tools/yuga-hashimoto-localant.md
- Homepage: https://github.com/yuga-hashimoto/localant
- Risk category: Write (Medium risk)
- Registry record: grade F, identity unverified
- Server rate-limited: no
- Parameters: 0
- Recommended policy verdict: Rate-limited

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "apply_patch",
    "arguments": {}
  }
}
```

## Why apply_patch is rated Medium

apply_patch modifies files in a working directory (Write category), making it neither Read (no retrieval-only) nor Destructive (has backups and dry-run safeguards, changes are reversible). Severity is high because an AI agent could apply malicious patches to introduce code vulnerabilities, alter configurations, or corrupt the codebase.

From the tool's own definition: "Tool applies unified diffs/patches to a working directory; modifies files reversibly. Description explicitly states 'dry-run checked, paths validated, backups kept', confirming changes are made to the filesystem and can be undone via backups or git operations."

## Use case

AI agents use apply_patch to create or update resources in LocalAnt, usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your LocalAnt environment.

## Recommended policy (PolicyLayer)

Verdict: **Rate-limited**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches LocalAnt:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "apply_patch": {
      "limits": [
        {
          "counter": "apply_patch_rate",
          "window": "minute",
          "max": 30,
          "scope": "grant"
        }
      ]
    }
  }
}
```

## Other tools on LocalAnt (215)

- `adb_clear_logcat` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/adb-clear-logcat.md
- `adb_uninstall` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/adb-uninstall.md
- `fs_delete_file_with_approval` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/fs-delete-file-with-approval.md
- `git_reset` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/git-reset.md
- `git_reset_hard` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/git-reset-hard.md
- `git_restore_file` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/git-restore-file.md
- `mcp_server_unregister` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/mcp-server-unregister.md
- `secret_remove` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/secret-remove.md
- `shell_remove_allowed_command` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/shell-remove-allowed-command.md
- `skill_uninstall` — Destructive — https://policylayer.com/tools/yuga-hashimoto-localant/skill-uninstall.md
- `adb_input_text` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-input-text.md
- `adb_install_apk` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-install-apk.md
- `adb_keyevent` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-keyevent.md
- `adb_shell` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-shell.md
- `adb_start_app` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-start-app.md
- `adb_stop_app` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-stop-app.md
- `adb_swipe` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-swipe.md
- `adb_tap` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/adb-tap.md
- `agent_run` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/agent-run.md
- `approval_approve` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/approval-approve.md
- `autopilot` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/autopilot.md
- `bash` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/bash.md
- `browser_click` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-click.md
- `browser_close` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-close.md
- `browser_evaluate` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-evaluate.md
- `browser_open` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-open.md
- `browser_press` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-press.md
- `browser_scroll` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-scroll.md
- `browser_select` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-select.md
- `browser_type` — Execute — https://policylayer.com/tools/yuga-hashimoto-localant/browser-type.md
- …and 185 more: https://policylayer.com/tools/yuga-hashimoto-localant.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=yuga-hashimoto-localant · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/yuga-hashimoto-localant
