docs: rename patch tool to apply_patch and clarify apply_patch behavior (#19979)

pull/19987/head^2
Chris Yang 2026-03-30 12:01:57 +08:00 committed by GitHub
parent 0465579d6b
commit ee018d5c82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -95,7 +95,7 @@ Create new files or overwrite existing ones.
Use this to allow the LLM to create new files. It will overwrite existing files if they already exist. Use this to allow the LLM to create new files. It will overwrite existing files if they already exist.
:::note :::note
The `write` tool is controlled by the `edit` permission, which covers all file modifications (`edit`, `write`, `patch`, `multiedit`). The `write` tool is controlled by the `edit` permission, which covers all file modifications (`edit`, `write`, `apply_patch`, `multiedit`).
::: :::
--- ---
@ -191,7 +191,7 @@ To configure which LSP servers are available for your project, see [LSP Servers]
--- ---
### patch ### apply_patch
Apply patches to files. Apply patches to files.
@ -206,8 +206,12 @@ Apply patches to files.
This tool applies patch files to your codebase. Useful for applying diffs and patches from various sources. This tool applies patch files to your codebase. Useful for applying diffs and patches from various sources.
When handling `tool.execute.before` or `tool.execute.after` hooks, check `input.tool === "apply_patch"` (not `"patch"`).
`apply_patch` uses `output.args.patchText` instead of `output.args.filePath`. Paths are embedded in marker lines within `patchText` and are relative to the project root (for example: `*** Add File: src/new-file.ts`, `*** Update File: src/existing.ts`, `*** Move to: src/renamed.ts`, `*** Delete File: src/obsolete.ts`).
:::note :::note
The `patch` tool is controlled by the `edit` permission, which covers all file modifications (`edit`, `write`, `patch`, `multiedit`). The `apply_patch` tool is controlled by the `edit` permission, which covers all file modifications (`edit`, `write`, `apply_patch`, `multiedit`).
::: :::
--- ---