-
Notifications
You must be signed in to change notification settings - Fork 437
Open
Description
Description
The documentation for the text_editor_20250728 built-in tool says the insert command uses new_str, but the model actually outputs insert_text.
Documentation (incorrect)
https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool
insert - Parameters:
insert_line: The line number after which to insert the textnew_str: The text to insert
Actual model output
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model":"claude-opus-4-5",
"max_tokens":200,
"tools":[{"type":"text_editor_20250728","name":"str_replace_based_edit_tool"}],
"messages":[{"role":"user","content":"Call insert to add HELLO after line 2 of /tmp/test.txt"}],
"tool_choice":{"type":"tool","name":"str_replace_based_edit_tool"}
}'Response:
{
"command": "insert",
"path": "/tmp/test.txt",
"insert_line": 2,
"insert_text": "HELLO\n"
}Model self-description
When asked "Show me insert command input/output spec", Claude responds:
|
insert_text| string | The text to insert |
The model is internally consistent — it uses and describes insert_text.
Impact
Third-party SDKs (like Vercel AI SDK) implement the documented schema (new_str), causing insert commands to fail silently because the model outputs insert_text.
Affected
- Documentation: https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool
- Reference implementation: https://github.com/anthropics/anthropic-quickstarts/blob/main/computer-use-demo/computer_use_demo/tools/edit.py (also expects
new_str)
Suggested fix
Update docs and reference implementation to use insert_text (matching model behavior).
Metadata
Metadata
Assignees
Labels
No labels