<!--
name: 'Tool Description: Edit'
description: Default SDK built-in tool description and input schema for Edit.
sdkPackage: '@anthropic-ai/claude-agent-sdk@0.3.168'
claudeCodeVersion: '2.1.168'
tool: "Edit"
-->
# Tool Description: Edit

## Metadata

- Request location: `tools[]`
- Tool name: `Edit`
- Input schema properties: `file_path`, `old_string`, `new_string`, `replace_all`

## Description

Performs exact string replacement in a file.

- You must Read the file in this conversation before editing, or the call will fail.
- `old_string` must match the file exactly, including indentation, and be unique — the edit fails otherwise. Strip the Read line prefix (line number + tab) before matching.
- `replace_all: true` replaces every occurrence instead.

## Input Schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "file_path": {
      "description": "The absolute path to the file to modify",
      "type": "string"
    },
    "old_string": {
      "description": "The text to replace",
      "type": "string"
    },
    "new_string": {
      "description": "The text to replace it with (must be different from old_string)",
      "type": "string"
    },
    "replace_all": {
      "description": "Replace all occurrences of old_string (default false)",
      "default": false,
      "type": "boolean"
    }
  },
  "required": [
    "file_path",
    "old_string",
    "new_string"
  ],
  "additionalProperties": false
}
```

## Token Impact

<!-- TOKEN_COUNT_START -->
- Complete definition estimated tokens: **329**
- Measurement: captured tool object serialized independently as JSON text against the common baseline
- Additivity: independent, non-additive estimate
<!-- TOKEN_COUNT_END -->
