Edit a Jupyter notebook
edit_notebookEdits a .ipynb notebook: replaces, inserts or deletes a cell. Cell indexes are 0-based; read_file shows them. A backup is saved before editing (undo_last_change). The file must be read first.
Instructions
Edits a .ipynb notebook: replaces, inserts or deletes a cell. Cell indexes are 0-based; read_file shows them. A backup is saved before editing (undo_last_change). The file must be read first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "edit_notebook"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cell | No | Cell index, 0-based | |
| mode | No | replace the cell, insert before it, or delete it | replace |
| path | Yes | Notebook path (.ipynb) | |
| source | No | New cell source (required for replace and insert) | |
| cell_type | No | Type for an inserted cell (default: code) |