Skip to main content

Files, Search, and Memory

These tools read, write, and search files, and they store memory notes. Use Read before Edit, because Edit replaces an exact string in a file. For example, Grep with output_mode set to files_with_matches lists only the files that match. The Yes and No columns are explained on Tools.

You can also read or edit files yourself and let Claude see the result. Deny the tool name in permissions.deny, or leave it out of a subagent tools list, to turn a tool off. The memory tools need a server-side flag.

Tools​

Source: Tools Reference, Configure Permissions, and the program (the tool input schemas).

ToolStatusWhat It DoesHow It WorksAvailable InRead-OnlyParallelDeferred
ReadDocumentedReads files, images, PDFs, and notebooks.See Read Parameters.Main session and subagents. Kept in background subagents.✅✅❌
WriteDocumentedCreates or overwrites a file.file_path (string, required, absolute), content (string, required), machine (optional). A deny rule wins.Main session and subagents. Kept in background subagents.❌❌❌
EditDocumentedReplaces an exact string in a file.file_path (required), old_string (required), new_string (required, must differ), replace_all (boolean, default false), machine (optional).Main session and subagents. Kept in background subagents.❌❌❌
NotebookEditDocumentedEdits a cell of a Jupyter notebook.See NotebookEdit Parameters.Main session and subagents. Kept in background subagents.❌❌✅
GlobDocumentedFinds files by glob pattern.pattern (string, required), path (string, optional, directory), machine (optional).Main session and subagents. The docs say a subagent can get Glob and Grep when the main session lacks them (macOS, Linux, WSL).✅✅❌
GrepDocumentedSearches file contents with ripgrep.See Grep Parameters.Same as Glob.✅✅❌
LSPDocumentedCode intelligence: definitions, references, symbols, hover, call hierarchy.operation, filePath (required), line (int, 1 or more, required), character (int, 1 or more, required), query (optional, workspaceSymbol only).Main session and subagents. Background subagents keep it since 2.1.280.✅✅✅
memory_readUndocumented GatedReads a document from a memory store.store (string, required), path (string, required).❓✅✅❌
memory_writeUndocumented GatedSaves a document to a memory store.store, path, content (all strings, required; content replaces the whole document), if_version (string, max 64, version token for compare-and-set).❓❌❌❌
memory_listUndocumented GatedLists memory stores and their documents.store (optional), path_prefix (optional, directory-aligned), cursor (optional).❓✅✅❌

Read Parameters​

ParameterWhat It DoesRequired
file_pathAbsolute path of the file.✅
offsetLine to start from, 0 or more.❌
limitNumber of lines to read, more than 0.❌
pagesPDF page range such as 1-5, at most 20 pages at a time.❌
allow_largeReads a file or range over the usual size limits, as far as the context allows.❌
machineName of an attached machine. Offered only when machines are attached.❌

NotebookEdit Parameters​

ParameterWhat It DoesRequired
notebook_pathAbsolute path of the .ipynb file.✅
new_sourceThe new source of the cell.✅
cell_idCell to edit. For insert, the new cell goes after it.❌
cell_typecode or markdown. Required for insert.❌
edit_modereplace (default), insert, or delete.❌

Grep Parameters​

ParameterWhat It DoesRequired
patternThe regular expression to search for.✅
pathFile or directory to search.❌
globGlob filter such as **/*.tsx.❌
output_modecontent, files_with_matches (default), or count.❌
-BLines before each match. Needs content mode.❌
-ALines after each match. Needs content mode.❌
-CAlias for context.❌
contextLines before and after each match. Needs content mode.❌
-nShows line numbers. Needs content mode, default true.❌
-iCase-insensitive search.❌
-oPrints only the matched parts. Needs content mode.❌
typeFile type such as js, py, or rust.❌
head_limitLimits the first N entries. Default 250, 0 for no limit.❌
offsetSkips the first N entries before head_limit.❌
multilineLets . match newlines and patterns span lines.❌
machineName of an attached machine. Offered only when machines are attached.❌

Example​

Block reads of secret files and all edits to lock files.

.claude/settings.json
{
"permissions": {
"deny": ["Read(./.env)", "Read(./secrets/**)", "Edit(./package-lock.json)"]
}
}

How It Works​

  • machine is an extra optional field that Claude Code adds to a tool schema when an attached-machines feature is on.
  • File tools check permissions with the rule syntax in Permission Rules.
  • Read, Glob, Grep, Write, and Edit carry remoteExecution metadata in the program. It marks them as runnable on a remote host.
  • Read has no result size cap, so use offset and limit for large files.