notebook_edit
Modify Jupyter notebook cells by replacing, inserting, or deleting content within a specific cell. Specify the absolute file path, cell index, and new source to update or manage notebook structure efficiently.
Instructions
Completely replaces the contents of a specific cell in a Jupyter notebook (.ipynb file) with new source. Jupyter notebooks are interactive documents that combine code, text, and visualizations, commonly used for data analysis and scientific computing. The notebook_path parameter must be an absolute path, not a relative path. The cell_number is 0-indexed. Use edit_mode=insert to add a new cell at the index specified by cell_number. Use edit_mode=delete to delete the cell at the index specified by cell_number.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
cell_number | Yes | The index of the cell to edit (0-based) | |
cell_type | No | The of the cell (code or markdown). If not specified, it defaults to the current cell type. If using edit_mode=insert, this is required. | code |
edit_mode | No | The of edit to make (replace, insert, delete). Defaults to replace. | replace |
new_source | No | The new source for the cell | |
notebook_path | Yes | The absolute path to the Jupyter notebook file to edit (must be absolute, not relative) |