find_replace_in_block
Replaces specific text within a Notion block while preserving bold, italic, links, and other formatting; returns an error with current text when no match is found.
Instructions
Find and replace text within a block, preserving all formatting.
Replaces occurrences of old_text with new_text in each rich text segment while keeping bold, italic, links, and other annotations intact.
Returns an error (not a silent no-op) if old_text does not appear in the block. The error message includes the block's current plain text so the caller can diagnose Unicode / whitespace / formatting mismatches (e.g., en-dash U+2013 vs hyphen-minus U+002D, curly vs straight quotes, non-breaking space U+00A0 vs regular space). Use update_block_text or update_table_cell for full-text replacement when find/replace doesn't match because of character mismatches.
The success response includes a replacements field with the total
number of occurrences of old_text that were replaced.
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": {
"block_id": "<block_id>",
"old_text": "<old_text>",
"new_text": "<new_text>"
},
"name": "find_replace_in_block"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| block_id | Yes | ||
| new_text | Yes | ||
| old_text | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |