View Source Anthropic.Tools.TextEditor (anthropic_community v0.5.0)

Builds the text editor server tool definition. Pass the result inside the :tools list to Anthropic.Messages.create/2 — Claude views/creates/edits files server-side in a sandbox and the result comes back as a %Anthropic.Messages.Content.TextEditorCodeExecutionToolResult{} block; no client-side execute/1 needed.

Examples

Anthropic.Messages.create(client,
  model: "claude-opus-4-8",
  max_tokens: 1024,
  tools: [Anthropic.Tools.TextEditor.new()],
  messages: [%{role: "user", content: "Fix the typo in main.py"}]
)

Summary

Functions

Options

  • :version (String.t/0) - The tool's versioned type string. Override to pin an older API version. The default value is "text_editor_20250728".

Functions

@spec new(keyword()) :: map()

Options

  • :version (String.t/0) - The tool's versioned type string. Override to pin an older API version. The default value is "text_editor_20250728".

  • :max_characters (pos_integer/0) - Maximum characters to display when viewing a file. Defaults to the full file.

  • :cache_control (map/0) - An Anthropic.CacheControl map.