Skip to content

Docs bug: text_editor insert command docs say new_str but model outputs insert_text #1155

@parthavshergill

Description

@parthavshergill

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 text
  • new_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

Suggested fix

Update docs and reference implementation to use insert_text (matching model behavior).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions