Built-in tool that enables Claude to edit text files.
Value
A tool specification for use with claude_new().
Details
The text editor tool provides structured file editing through string replacement operations. Claude can view file contents, replace text, and insert content at specific locations.
Types:
"basic": Standard str_replace editor (text_editor_20250124)"advanced": Enhanced editor with more features (text_editor_20250728)
API Reference: https://platform.claude.com/docs/en/api/messages
Examples
if (FALSE) { # \dontrun{
# Basic text editor
chat <- claude_new(tools = list(claude_text_editor()))
chat$chat("Create a file called test.txt with 'Hello World'")
# Advanced text editor
chat <- claude_new(tools = list(claude_text_editor(type = "advanced")))
chat$chat("Edit config.yaml to set port: 8080")
} # }
