text-editor-tool changedagents-and-tools/tool-use/text-editor-tool
Nearest release: v2.1.307, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+29added
Lines−29removed
From line
225
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits9to this page, all time
The whole hunk
from line 225, old and new numbered
/
from line 225
225225
226226<Steps>
227227 <Step title="Provide Claude with the text editor tool and a user prompt">
228 * Include the text editor tool in your API request
229 * Provide a user prompt that may require examining or modifying files, such as "Can you fix the syntax error in my code?"
228 * Include the text editor tool in your API request.
229 * Provide a user prompt that might require examining or modifying files, such as "Can you fix the syntax error in my code?"
230230 </Step>
231231
232232 <Step title="Claude uses the tool to examine files or directories">
233 * Claude assesses what it needs to look at and uses the `view` command to examine file contents or list directory contents
234 * The API response will contain a `tool_use` content block with the `view` command
233 * Claude assesses what it needs to look at and uses the `view` command to examine file contents or list directory contents.
234 * The API response contains a `tool_use` content block with the `view` command.
235235 </Step>
236236
237 <Step title="Execute the view command and return results">
238 * Extract the file or directory path from Claude's tool use request
239 * Read the file's contents or list the directory contents
240 * If a `max_characters` parameter was specified in the tool configuration, truncate the file contents to that length
241 * Return the results to Claude by continuing the conversation with a new `user` message containing a `tool_result` content block
237 <Step title="Run the view command and return results">
238 * Extract the file or directory path from Claude's tool use request.
239 * Read the file's contents or list the directory contents.
240 * If you specified a `max_characters` parameter in the tool configuration, truncate the file contents to that length.
241 * Return the results to Claude by continuing the conversation with a new `user` message containing a `tool_result` content block.
242242 </Step>
243243
244244 <Step title="Claude uses the tool to modify files">
245 * After examining the file or directory, Claude may use a command such as `str_replace` to make changes or `insert` to add text at a specific line number.
246 * If Claude uses the `str_replace` command, Claude constructs a properly formatted tool use request with the old text and new text to replace it with
245 * After examining the file or directory, Claude might use a command such as `str_replace` to make changes or `insert` to add text at a specific line number.
246 * If Claude uses the `str_replace` command, Claude constructs a properly formatted tool use request with the old text and new text to replace it with.
247247 </Step>
248248
249 <Step title="Execute the edit and return results">
250 * Extract the file path, old text, and new text from Claude's tool use request
251 * Perform the text replacement in the file
252 * Return the results to Claude
249 <Step title="Make the edit and return results">
250 * Extract the file path, old text, and new text from Claude's tool use request.
251 * Perform the text replacement in the file.
252 * Return the results to Claude.
253253 </Step>
254254
255255 <Step title="Claude provides its analysis and explanation">
256 * After examining and possibly editing the files, Claude provides a complete explanation of what it found and what changes it made
256 * After examining and possibly editing the files, Claude provides a complete explanation of what it found and what changes it made.
257257 </Step>
258258</Steps>
259259
from line 1484
14841484
14851485<Steps>
14861486 <Step title="Initialize your editor implementation">
1487 Create helper functions to handle file operations like reading, writing, and modifying files. Consider implementing backup functionality to recover from mistakes.
1487 Create helper functions to handle file operations such as reading, writing, and modifying files. Consider implementing backup functionality to recover from mistakes.
14881488 </Step>
14891489
14901490 <Step title="Handle editor tool calls">
from line 1773
17731773
17741774### Handle errors
17751775
1776When using the text editor tool, various errors may occur. Here is guidance on how to handle them:
1776When using the text editor tool, various errors might occur. Here is guidance on how to handle them:
17771777
17781778<AccordionGroup>
17791779 <Accordion title="File not found">
1780 If Claude tries to view or modify a file that doesn't exist, return an appropriate error message in the `tool_result`:
1780 If Claude attempts to view or modify a file that doesn't exist, return an appropriate error message in the `tool_result`:
17811781
17821782 ```json
17831783 {
from line 1853
18531853
18541854<AccordionGroup>
18551855 <Accordion title="Provide clear context">
1856 When asking Claude to fix or modify code, be specific about what files need to be examined or what issues need to be addressed. Clear context helps Claude identify the right files and make appropriate changes.
1856 When asking Claude to fix or modify code, be specific about what files to examine or what issues to address. Clear context helps Claude identify the right files and make appropriate changes.
18571857
18581858 **Less helpful prompt:** "Can you fix my code?"
18591859
from line 2250
22502250| Date | Version | Changes |
22512251| ---------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
22522252| July 28, 2025 | `text_editor_20250728` | Release of an updated text editor tool that fixes some issues and adds an optional `max_characters` parameter. It is otherwise identical to `text_editor_20250429`. |
2253| April 29, 2025 | `text_editor_20250429` | Release of the text editor tool for Claude 4. This version removes the `undo_edit` command but maintains all other capabilities. The tool name has been updated to reflect its str\_replace-based architecture. |
2253| April 29, 2025 | `text_editor_20250429` | Release of the text editor tool for Claude 4. This version removes the `undo_edit` command but maintains all other capabilities. The tool name has been updated to reflect its `str_replace`-based architecture. |
22542254| March 13, 2025 | `text_editor_20250124` | Introduction of standalone text editor tool documentation. This version is optimized for Claude Sonnet 3.7 but has identical capabilities to the previous version. |
22552255| October 22, 2024 | `text_editor_20241022` | Initial release of the text editor tool with Claude Sonnet 3.5 (retired; see [Model deprecations](https://platform.claude.com/docs/en/about-claude/model-deprecations)). Provides capabilities for viewing, creating, and editing files through the `view`, `create`, `str_replace`, `insert`, and `undo_edit` commands. |
22562256
from line 2258
22582258
22592259Here are some ideas for how to use the text editor tool in more convenient and powerful ways:
22602260
2261* **Integrate with your development workflow**: Build the text editor tool into your development tools or IDE
2262* **Create a code review system**: Have Claude review your code and make improvements
2263* **Build a debugging assistant**: Create a system where Claude can help you diagnose and fix issues in your code
2264* **Implement file format conversion**: Let Claude help you convert files from one format to another
2265* **Automate documentation**: Set up workflows for Claude to automatically document your code
2261* **Integrate with your development workflow:** Build the text editor tool into your development tools or IDE
2262* **Create a code review system:** Have Claude review your code and make improvements
2263* **Build a debugging assistant:** Create a system where Claude can help you diagnose and fix issues in your code
2264* **Implement file format conversion:** Let Claude help you convert files from one format to another
2265* **Automate documentation:** Set up workflows for Claude to automatically document your code
22662266
2267The text editor tool enables Claude to work directly with your code base, supporting workflows from debugging to automated documentation.
2267The text editor tool allows Claude to work directly with your code base, supporting workflows from debugging to automated documentation.
22682268
22692269<CardGroup cols={3}>
22702270 <Card title="Tool use overview" icon="wrench" href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview">
from line 2272
22722272 </Card>
22732273
22742274 <Card title="Bash tool" icon="terminal" href="https://platform.claude.com/docs/en/agents-and-tools/tool-use/bash-tool">
2275 Execute shell commands with Claude.
2275 Run shell commands with Claude.
22762276 </Card>
22772277</CardGroup>
22782278
No line in this hunk matches that.