Search notes
search_notesFind notes by full-text and attribute filters in Trilium; returns metadata and optional short content previews to identify matches before reading full note bodies.
Instructions
Find notes by full-text and/or attribute filters (Trilium search syntax). Returns metadata only (noteId, title, type, mime, dateModified, parentNoteIds, attributes); read bodies with get_note, or set content_preview_chars for short previews.
Syntax:
rings tolkien— all words must appear (AND);"exact phrase"for phrases.#label,#!label(without),#year >= 1950,#name *=* john,~relation; combine with fulltext by spaces (AND).Operators: = != = (contains) =* (starts) *= (ends) %= (regex) >= > < <=. Group with parentheses and AND/OR, e.g.
(#year >= 1950 AND #year <= 1960),#book or #article.a or bbetween plain words is rewritten to match note content only (not titles); for titles usetitle:a or title:b.title:weekly meeting— title contains the text (auto-quoted; trailing #label/~relation filters still apply).id:abc123— direct lookup by note ID. A lone 12-character alphanumeric token containing a digit is also tried as an ID first.Properties: note.title, note.dateCreated, note.dateModified, note.parents.title, note.ancestors.title.
Scope a subtree with ancestorNoteId + ancestorDepth. If a plain multi-word query finds nothing, it is retried as a ranked OR (see fuzzy); the response then has searchMode:"fuzzy" and termsMatchedInTitleOrAttributes. partial:true means part of the search did not finish; read the note field.
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": {
"query": "<query>"
},
"name": "search_notes"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| debug | No | Return query-parse diagnostics from Trilium (for troubleshooting search syntax). | |
| fuzzy | No | "auto" (default): a plain multi-word query with zero results is retried as a ranked OR over its words. "off": exact only. "force": skip the exact attempt. The automatic retry never runs with strategy:"fast" (it would search note bodies). | auto |
| limit | No | Maximum results (default 50). The response reports truncated:true when more matched. | |
| query | Yes | Trilium search query; see tool description for syntax. | |
| orderBy | No | Property to order by: title, dateCreated, dateModified, utcDateCreated, utcDateModified, isProtected, isArchived, or a label (e.g. "#publicationDate"). | |
| verbose | No | Return full note metadata (child/branch IDs, blobId, UTC dates, isInheritable). Default false. | |
| strategy | No | "auto" (default): plain-word queries match titles/labels first and search note bodies only when that finds fewer than 5 notes. "fast": titles/labels only. "full": always search bodies (slow on large Trilium; blocks it meanwhile). Trilium-syntax queries run as written. | |
| fastSearch | No | Low-level flag: true matches titles and labels only. Overrides `strategy`. | |
| ancestorDepth | No | Depth constraint relative to ancestorNoteId: "eq1" = direct children only, "lt3" = fewer than 3 levels deep, "gt1" = deeper than direct children. | |
| ancestorNoteId | No | Restrict results to descendants of this note (combine with ancestorDepth). | |
| orderDirection | No | Order direction | |
| includeArchivedNotes | No | Include archived notes | |
| content_preview_chars | No | Attach a plain-text "contentPreview" (first N characters, HTML stripped) to the first 20 results so you can tell candidates apart without a get_note call per result. 0 (default) = off. 200-300 is usually enough. Skipped for binary (image/file) and protected notes. |