Text editor tool (text_editor_20250728 / text_editor_20250429 / text_editor_20250124)
Status: DOCUMENTED · LIVE_VERIFIED 2026-09-18 (h6 text_editor_20250728 on haiku 4.5 → view /tmp; h9 wrong name → 400; k15/k16 older versions → 400 on haiku; j5 count_tokens 1252). Nothing was executed.
Sources: Text editor tool · Tool reference · Messages API.
Last verified: 2026-09-18.
Definition
{"type": "text_editor_20250728", "name": "str_replace_based_edit_tool", "max_characters": 10000}Schema-less client tool (no input_schema). name is fixed: live 400 tools.0.text_editor_20250728.name: Input should be 'str_replace_based_edit_tool'. Optional: max_characters (20250728+ only, truncation for view), plus generic cache_control, defer_loading, strict, input_examples, allowed_callers.
| Version | Date | Model target (docs) | Live on haiku 4.5 | Name | Commands |
|---|---|---|---|---|---|
text_editor_20250728 |
2025-07-28 | Claude 4 and later | 200 | str_replace_based_edit_tool |
view, str_replace, create, insert (+ max_characters) |
text_editor_20250429 |
2025-04-29 | Claude 4 | 400 "does not support tool types" | str_replace_based_edit_tool |
view, str_replace, create, insert (undo_edit removed) |
text_editor_20250124 |
2025-03-13 | Claude Sonnet 3.7 (retired) | 400 | str_replace_editor |
view, str_replace, create, insert, undo_edit |
text_editor_20241022 |
2024-10-22 | Sonnet 3.5 (retired), beta computer-use-2024-10-22 |
— | str_replace_editor |
same as 20250124 |
The GA schema still accepts the 20250429/20250124 tags for every model (k_types), but haiku 4.5 rejects them at the model gate; other current models were not probed (UNVERIFIED). Use text_editor_20250728 for all current models.
Commands Claude emits (tool_use.input)
command |
Parameters | Your result |
|---|---|---|
view |
path, view_range?: [start, end] (1-indexed, -1 = EOF; files only) |
file content, ideally with N: line-number prefixes (needed for view_range/insert_line), or directory listing |
str_replace |
path, old_str (exact, must match exactly once), new_str |
Successfully replaced text at exactly one location. or error (Found 3 matches…, No match found…) |
create |
path, file_text |
confirmation |
insert |
path, insert_line (0 = top), insert_text |
confirmation |
undo_edit (20250124/20241022 only) |
path |
confirmation |
Live h6: {"type":"tool_use","name":"str_replace_based_edit_tool","input":{"command":"view","path":"/tmp"},"caller":{"type":"direct"}}.
Errors go back as tool_result with is_error:true (Error: File not found, Error: Permission denied…).
Implementation notes / security
Validate paths (no traversal), back up before edits, enforce single-match replacement, verify changes (e.g. ast.parse). Pairs with the bash tool ("coding agent"). Pricing: ≈700 extra input tokens for the definition (docs, 20250429); live count_tokens haiku 4.5: 1,252 tokens for a one-line prompt + tool (vs 11 without tools).
Examples: examples/anthropic/tools/text-editor/basic.{sh,py,ts}.