Skip to main content
Glama

Replace in Note

replace_in_note
Destructive

Replace text in a note using literal strings or regex patterns. Optionally set an expected match count to prevent accidental over-replacement.

Instructions

Search-and-replace within a single note. Supports literal strings or regex patterns. With expectedCount, the operation refuses to commit unless that many matches are present, guarding against accidental over-replacement when an LLM drafts a pattern that's too broad. Returns the count of replacements made.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
findYesLiteral string (default) or regex pattern to match.
pathYesVault-relative path to the note.
flagsNoRegex flags (e.g., 'gi'). Defaults to 'g' so all matches are replaced.
regexNoTreat `find` as a JavaScript regex (multi-line, case-sensitive by default).
replaceYesReplacement text. With `regex: true`, supports $1, $2 backreferences.
expectedCountNoIf set, abort unless exactly this many matches are found.
Behavior5/5

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

Annotations indicate destructiveHint=true and readOnlyHint=false. The description adds valuable behavioral context: the expectedCount guard prevents accidental over-replacement, and it returns the replacement count. This goes beyond what annotations provide.

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 three sentences, each adding critical information. It is front-loaded with the core purpose, then explains the regex option and safety guard, and finally the return value. No wasted words.

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

Completeness4/5

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

For a destructive tool with 6 parameters and no output schema, the description covers the operation, the guard, and return value. It does not explain error handling for expectedCount mismatch (e.g., what happens if count doesn't match), but the phrase 'refuses to commit' implies an abort. Adequate but has a minor gap.

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?

Schema coverage is 100%, so parameters are documented. The description adds meaning by explaining the distinction between literal and regex, the purpose of expectedCount (guard against over-replacement), and that backreferences work with regex. This is useful context beyond schema descriptions.

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 it performs a search-and-replace within a single note, supporting literal strings and regex. This distinguishes it from sibling tools like append_to_note or edit_block, which are not find-and-replace operations.

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

Usage Guidelines4/5

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

The description specifies it operates on a single note, implying when to use it. It does not explicitly mention when not to use it or provide alternatives, but the context is clear enough. The expectedCount guard adds usage guidance.

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/rps321321/obsidian-mcp-pro'

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