Skip to main content
Glama
cphoskins
by cphoskins

find_replace_in_block

Find and replace text within a Notion block while preserving all formatting. If the text is not found, receive an error with the block's current plain text to diagnose mismatches.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
block_idYes
old_textYes
new_textYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the error behavior (non-silent, includes current plain text for diagnostics), the success response (includes 'replacements' field with count), and the preservation of formatting. However, it does not explicitly state that the tool modifies data (destructive), which is implied but could be clarified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured: one sentence for purpose, followed by details on behavior, error handling, and alternatives. Every sentence earns its place with no redundancy. The critical information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 required parameters), no output schema (though context says there is one, but description already mentions the 'replacements' field), and no annotations, the description is complete. It covers purpose, behavior, error handling, and usage guidance, providing all necessary information for correct selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% coverage (no descriptions). The description compensates by explaining that old_text is the text to find and new_text is the replacement. It also clarifies that the function replaces in each rich text segment and raises an error if old_text is absent. This adds significant semantic value beyond parameter names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Find and replace text within a block, preserving all formatting.' This is a specific verb+resource combination. It further distinguishes from sibling tools by explicitly mentioning when to use alternatives like update_block_text or update_table_cell.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool and when not to: it returns an error if old_text is not found, and suggests using update_block_text or update_table_cell for full-text replacement when character mismatches occur. This helps the agent choose correctly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cphoskins/notion-full-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server