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

## Metadata

- Request location: `tools[]`
- Tool name: `NotebookEdit`
- Input schema properties: `notebook_path`, `cell_id`, `new_source`, `cell_type`, `edit_mode`

## Description

Replaces, inserts, or deletes a single cell in a Jupyter notebook (.ipynb file).

Usage:
- You must use the Read tool on the notebook in this conversation before editing — this tool will fail otherwise.
- `notebook_path` must be an absolute path.
- `cell_id` is the `id` attribute shown in the Read tool's `<cell id="...">` output. It is required for `replace` and `delete`.
- `edit_mode` defaults to `replace`. Use `insert` to add a new cell after the cell with the given `cell_id` (or at the beginning of the notebook if `cell_id` is omitted) — `cell_type` is required when inserting. Use `delete` to remove the cell.

## Input Schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "notebook_path": {
      "description": "The absolute path to the Jupyter notebook file to edit (must be absolute, not relative)",
      "type": "string"
    },
    "cell_id": {
      "description": "The ID of the cell to edit. When inserting a new cell, the new cell will be inserted after the cell with this ID, or at the beginning if not specified.",
      "type": "string"
    },
    "new_source": {
      "description": "The new source for the cell",
      "type": "string"
    },
    "cell_type": {
      "description": "The type of the cell (code or markdown). If not specified, it defaults to the current cell type. If using edit_mode=insert, this is required.",
      "type": "string",
      "enum": [
        "code",
        "markdown"
      ]
    },
    "edit_mode": {
      "description": "The type of edit to make (replace, insert, delete). Defaults to replace.",
      "type": "string",
      "enum": [
        "replace",
        "insert",
        "delete"
      ]
    }
  },
  "required": [
    "notebook_path",
    "new_source"
  ],
  "additionalProperties": false
}
```

## Token Impact

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