mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-23 17:10:37 +01:00
3436e51042
Self-Review Checklist: - [ ] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - N/A
111 lines
5.1 KiB
Markdown
111 lines
5.1 KiB
Markdown
---
|
|
title: AI Agent Tools - Zed
|
|
description: Built-in tools for Zed's AI agent including file editing, code search, terminal commands, web search, and diagnostics.
|
|
---
|
|
|
|
# Tools
|
|
|
|
Zed's built-in agent has access to these tools for reading, searching, and editing your codebase. These tools are used in the [Agent Panel](./agent-panel.md) during conversations with AI agents.
|
|
|
|
You can configure permissions for tool actions, including situations where they are automatically approved, automatically denied, or require your confirmation on a case-by-case basis. See [Tool Permissions](./tool-permissions.md) for the list of permission-gated tools and details.
|
|
|
|
To add custom tools beyond these built-in ones, see [MCP servers](./mcp.md).
|
|
|
|
## Read & Search Tools
|
|
|
|
### `diagnostics`
|
|
|
|
Gets errors and warnings for either a specific file or the entire project, useful after making edits to determine if further changes are needed.
|
|
When a path is provided, shows all diagnostics for that specific file.
|
|
When no path is provided, shows a summary of error and warning counts for all files in the project.
|
|
|
|
**Example:** After editing `src/parser.rs`, call `diagnostics` with that path to check for type errors immediately. After a larger refactor touching many files, call it without a path to see a project-wide count of errors before deciding what to fix next.
|
|
|
|
### `fetch`
|
|
|
|
Fetches a URL and returns the content as Markdown. Useful for providing docs as context.
|
|
|
|
**Example:** Fetching a library's changelog page to check whether a breaking API change was introduced in a recent version before writing integration code.
|
|
|
|
### `find_path`
|
|
|
|
Quickly finds files by matching glob patterns (like "\*_/_.js"), returning matching file paths alphabetically.
|
|
|
|
### `grep`
|
|
|
|
Searches file contents across the project using regular expressions, preferred for finding symbols in code without knowing exact file paths.
|
|
|
|
**Example:** To find every call site of a function before renaming it, search for `parse_config\(` — the regex matches the function name followed by an opening parenthesis, filtering out comments or variable names that happen to contain the string.
|
|
|
|
### `list_directory`
|
|
|
|
Lists files and directories in a given path, providing an overview of filesystem contents.
|
|
|
|
### `now`
|
|
|
|
Returns the current date and time.
|
|
|
|
### `open`
|
|
|
|
Opens a file or URL with the default application associated with it on the user's operating system.
|
|
|
|
### `read_file`
|
|
|
|
Reads the content of a specified file in the project, allowing access to file contents.
|
|
|
|
### `thinking`
|
|
|
|
Allows the Agent to work through problems, brainstorm ideas, or plan without executing actions, useful for complex problem-solving.
|
|
|
|
### `search_web`
|
|
|
|
Searches the web for information, providing results with snippets and links from relevant web pages, useful for accessing real-time information.
|
|
|
|
**Example:** Looking up whether a known bug in a dependency has been patched in a recent release, or finding the current API signature for a third-party library when the local docs are out of date.
|
|
|
|
## Edit Tools
|
|
|
|
### `copy_path`
|
|
|
|
Copies a file or directory recursively in the project, more efficient than manually reading and writing files when duplicating content.
|
|
|
|
### `create_directory`
|
|
|
|
Creates a new directory at the specified path within the project, creating all necessary parent directories (similar to `mkdir -p`).
|
|
|
|
### `delete_path`
|
|
|
|
Deletes a file or directory (including contents recursively) at the specified path and confirms the deletion.
|
|
|
|
### `edit_file`
|
|
|
|
Edits files by replacing specific text with new content.
|
|
|
|
**Example:** Updating a function signature — the agent identifies the exact lines to replace and provides the updated version, leaving the surrounding code untouched. For widespread renames, it pairs this with `grep` to find every occurrence first.
|
|
|
|
### `move_path`
|
|
|
|
Moves or renames a file or directory in the project, performing a rename if only the filename differs.
|
|
|
|
### `restore_file_from_disk`
|
|
|
|
Discards unsaved changes in open buffers by reloading file contents from disk. Useful for resetting files to their on-disk state before retrying an edit.
|
|
|
|
### `save_file`
|
|
|
|
Saves files that have unsaved changes. Used when files need to be saved before further edits can be made.
|
|
|
|
### `terminal`
|
|
|
|
Executes shell commands and returns the combined output, creating a new shell process for each invocation.
|
|
|
|
**Example:** After editing a Rust file, run `cargo test --package my_crate 2>&1 | tail -30` to confirm the changes don't break existing tests. Or run `git diff --stat` to review which files have been modified before wrapping up a task.
|
|
|
|
## Other Tools
|
|
|
|
### `spawn_agent`
|
|
|
|
Spawns a subagent with its own context window to perform a delegated task. Useful for running parallel investigations, completing self-contained tasks, or performing research where only the outcome matters. Each subagent has access to the same tools as the parent agent.
|
|
|
|
**Example:** While refactoring the authentication module, spawn a subagent to investigate how session tokens are validated elsewhere in the codebase. The parent agent continues its work and reviews the subagent's findings when it completes — keeping both context windows focused on a single task.
|