Skip to main content
Glama
tan-yong-sheng

TriliumNext Notes' MCP Server

search_and_replace_note

Replace text in TriliumNext notes using search patterns. Update note content by specifying search and replacement text, with regex support and version safety checks.

Instructions

Search and replace content within a single note. When someone wants to replace text in a note, first call get_note to get the current content and hash, then use this function to make the changes. This ensures you're working with the latest version of their note.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteIdYesID of the note to perform search and replace on
searchPatternYesWhat to search for in the note.
replacePatternYesWhat to replace it with. For regex: supports patterns like '$1' for captured groups.
useRegexNoWhether to use regex patterns (default: true).
searchFlagsNoSearch options. Defaults to 'gi' (global, case-insensitive). Remove 'i' for exact case matching.gi
expectedHashYes⚠️ REQUIRED: Content hash from get_note response. Always get the note content first to obtain this hash.
revisionNoWhether to create a backup before replacing (default: true for safety).
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 effectively describes the mutation nature of the operation ('replace content'), specifies a safety mechanism ('create a backup before replacing' via the revision parameter), and outlines a concurrency control requirement ('expectedHash' to ensure working with the latest version). However, it doesn't mention potential error conditions or rate limits.

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 perfectly concise with two sentences that each serve distinct purposes: the first states the core functionality, and the second provides critical workflow guidance. There's no redundancy or unnecessary elaboration, and the information is front-loaded with the most important details.

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 mutation tool with 7 parameters, no annotations, and no output schema, the description does well by explaining the core operation, safety considerations, and required workflow. However, it doesn't describe what the tool returns or potential error cases, leaving some gaps in understanding the complete interaction context.

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

Parameters3/5

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

With 100% schema description coverage, the baseline is 3. The description adds some context about the 'expectedHash' parameter ('Content hash from get_note response') and implies the workflow relationship, but doesn't provide additional semantic meaning beyond what's already documented in the comprehensive schema descriptions for all 7 parameters.

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 explicitly states the specific action ('search and replace content within a single note'), clearly identifying both the verb and resource. It distinguishes from siblings like 'update_note' by focusing on text replacement rather than general updates, and from 'search_notes' by operating on content within a single note rather than searching across notes.

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 ('When someone wants to replace text in a note') and includes a clear prerequisite workflow ('first call get_note to get the current content and hash, then use this function'). It also distinguishes from alternatives by specifying this is for content replacement within a single note, not for other note operations.

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/tan-yong-sheng/triliumnext-mcp'

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