Search and replace in a pad
replace_in_documentReplace an exact string in a collaborative pad, editing only matched ranges to avoid conflicts. Use replace_all to change every occurrence, with confirmation for multiple replacements.
Instructions
Replaces an exact string in a pad with another. Only the matched ranges are edited, so concurrent edits elsewhere in the pad survive. By default the search string must match exactly once; set replace_all to change every occurrence. Replacing more than one occurrence at once asks a person first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Id of the pad, the part after # in its URL | |
| search | Yes | Exact string to find (no regex) | |
| replace | Yes | Replacement; may be empty to delete the match | |
| replace_all | No | Replace every occurrence instead of requiring a unique match | |
| confirm_token | No | Confirmation token from a previous call of this tool with the same arguments. Omit on the first call. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| url | Yes | Shareable; anyone with it can read and edit. | |
| note | Yes | ||
| characters | Yes | Length of the pad after the write, in codepoints. | |
| replacements | Yes |