# Claude Code File Tools

> The Claude Code tools that read, write, edit and find files. Which ones ask first, how Edit matches text, and why Glob and Grep may be missing.

**Course:** [Claude Code Basics](https://learn.benibix.com/learn/ai-claude-code)  
**Time:** 10 min

**After this lesson you can:**

- Name the file tools and what each does
- Say which tools ask before they run
- Write a tool name in a permission rule

## Which tools touch your files

A built-in tool is one action Claude Code gives Claude, such as Read, Edit or Bash. Claude picks the tool for each step. You only name tools when you write rules for them. Read opens a file and returns up to 25,000 tokens per call, so Claude reads a long file in pages. Read never asks first.

Write makes a new file, or replaces a whole file with new text. Edit changes one part of a file. It takes a piece of old text and the new text to put in its place. The old text must match the file exactly, down to the spaces, and it must appear only once. Both tools ask before they run.

That exact match is what keeps Edit safe. It never guesses which line you meant. If the old text shows up twice, Claude must add more of the lines around it, or ask to replace every copy. NotebookEdit does the same job for a Jupyter notebook, one cell at a time.

Glob finds files by name, with a pattern such as **/*.ts for every TypeScript file. It returns up to 100 files, newest first. Grep searches inside files for text, and it is built on a fast search program called ripgrep. Neither one asks first.

On macOS, Linux and WSL, Claude Code leaves Glob and Grep out by default. Claude runs find and grep through Bash instead, which does the same work. On Windows both tools are on. So do not be surprised when your session shows no Glob calls at all.

The LSP tool lets Claude use a language server, the same helper your code editor uses. After each edit it reports type errors and warnings, so Claude can fix them without a full build. It can also jump to where a function is made. It stays off until you add a code intelligence plugin for your language.

A tool's name is also how you write rules for it. The same form, a name with an optional pattern in brackets, works in permission rules, in the --allowedTools flag and in a helper's tool list. Edit(./src/**) means edits inside src. Read(./.env) means reading that one file.

```json
{
  "permissions": {
    "allow": ["Edit(./src/**)"],
    "deny": ["Edit(./dist/**)", "Read(./.env)"]
  }
}
```
Edits inside src run without asking. The built folder and the secrets file stay off limits.

![Six tool cards in a row, from finding to changing: Glob finds by name, Grep finds lines, Read opens a file, Write replaces it all, Edit swaps one part, and LSP reports errors after edits. A note says NotebookEdit does the same for one cell of a notebook.](https://learn.benibix.com/diagrams/ct-file-tools.svg)

### Example: Lucy's edit misses by one space

Lucy watches an Edit fail on a config file. The old text Claude sent had 4 spaces, and the file had a tab.

Claude reads the file again, copies the line exactly, and the second Edit works. Nothing was changed by the failed try.

**Words in this lesson:** [Claude Code Built-in Tool](https://learn.benibix.com/term/ai/claude-code-built-in-tool), [Read Tool](https://learn.benibix.com/term/ai/read-tool), [Write Tool](https://learn.benibix.com/term/ai/write-tool), [Edit Tool](https://learn.benibix.com/term/ai/edit-tool), [NotebookEdit Tool](https://learn.benibix.com/term/ai/notebook-edit-tool), [Glob Tool](https://learn.benibix.com/term/ai/glob-tool), [Grep Tool](https://learn.benibix.com/term/ai/grep-tool), [LSP Tool](https://learn.benibix.com/term/ai/lsp-tool)

**Question:** Why can the Edit tool not change the wrong line by mistake?

**Answer:** The old text must match exactly and appear only once. Edit swaps one exact piece of text for another. If the text does not match, or shows up more than once, the edit fails instead of guessing.

---

Source: https://learn.benibix.com/learn/ai-claude-code/claude-code-file-tools
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
