edit_paragraph
Replace an exact code snippet in a paragraph with find-and-replace, automatically backing up previous content. Use for targeted edits instead of rewriting the whole paragraph.
Instructions
Replace an exact snippet of paragraph code (find-and-replace). Previous content is automatically backed up before changes.
Prefer this over update_paragraph for targeted changes — you send only the changed snippet
instead of the whole paragraph. Use update_paragraph for whole rewrites.
old_string must match the current code exactly, including whitespace and indentation: copy it
from get_paragraph_code (raw text), not from get_notebook/get_paragraph (they indent code by
2 spaces). Keep it minimal but unique — include a neighbouring line if the snippet repeats.
Args:
notebook_id: The notebook ID containing the paragraph
paragraph_id: The paragraph ID to edit
old_string: Exact existing text to replace (must occur once unless replace_all)
new_string: Replacement text
replace_all: Replace every occurrence instead of requiring a unique match (e.g. renames)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new_string | Yes | ||
| old_string | Yes | ||
| notebook_id | Yes | ||
| replace_all | No | ||
| paragraph_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |