Skip to main content
Glama
triliumnext-mcp

triliumnext-mcp

by perfectra1n

Search notes

search_notes
Read-onlyIdempotent

Find 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 b between plain words is rewritten to match note content only (not titles); for titles use title: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

NameRequiredDescriptionDefault
debugNoReturn query-parse diagnostics from Trilium (for troubleshooting search syntax).
fuzzyNo"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
limitNoMaximum results (default 50). The response reports truncated:true when more matched.
queryYesTrilium search query; see tool description for syntax.
orderByNoProperty to order by: title, dateCreated, dateModified, utcDateCreated, utcDateModified, isProtected, isArchived, or a label (e.g. "#publicationDate").
verboseNoReturn full note metadata (child/branch IDs, blobId, UTC dates, isInheritable). Default false.
strategyNo"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.
fastSearchNoLow-level flag: true matches titles and labels only. Overrides `strategy`.
ancestorDepthNoDepth constraint relative to ancestorNoteId: "eq1" = direct children only, "lt3" = fewer than 3 levels deep, "gt1" = deeper than direct children.
ancestorNoteIdNoRestrict results to descendants of this note (combine with ancestorDepth).
orderDirectionNoOrder direction
includeArchivedNotesNoInclude archived notes
content_preview_charsNoAttach 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv0.4.0
    • changedInput schema / properties / ancestorNoteId / description
      Previous value: -"Search only in subtree of this note"New value: +"Restrict results to descendants of this note (combine with ancestorDepth)."
    • addedInput schema / properties / ancestorNoteId / maxLength
      Added value: +128
    • addedInput schema / properties / ancestorNoteId / minLength
      Added value: +1
    • addedInput schema / properties / ancestorNoteId / pattern
      Added value: +"^[A-Za-z0-9_]+$"
    • changedInput schema / properties / fastSearch / description
      Previous value: -"Low-level Trilium flag: true matches titles and labels only. Setting it overrides `strategy`."New value: +"Low-level flag: true matches titles and labels only. Overrides `strategy`."
    • changedInput schema / properties / fuzzy / description
      Previous value: -"Fallback behavior when the query finds nothing. \"auto\" (default): if the exact query returns ZERO results and the query is plain fulltext with 2+ terms, retry it as an OR over the individual terms, ranked by title/attribute relevance — the response then carries searchMode:\"fuzzy\" and fuzzyTerms. \"off\": never retry; exact Trilium semantics only. \"force\": go straight to the ranked OR search. Never applies to attribute (#label), property (note.*), id:/title:-prefixed, or already-OR queries."New value: +"\"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)."
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum number of results. No default — pass one to bound large result sets."New value: +"Maximum results (default 50). The response reports truncated:true when more matched."
    • changedInput schema / properties / query / description
      Previous value: -"Trilium search query. Fulltext: \"word1 word2\" (implicit AND), \"exact phrase\" (quotes). Labels: #label, #label=value, #!label (negation). Relations: ~relation. Operators: = != *=* =* *= >= > < <=. Boolean: \"term1 or term2\" for OR between any terms, AND with parentheses. Examples: \"meeting\", \"#project\", \"#status = active\", \"meeting #project\""New value: +"Trilium search query; see tool description for syntax."
    • changedInput schema / properties / strategy / description
      Previous value: -"How hard to search. \"auto\" (default): a plain-word query first matches note titles and labels only (milliseconds) and searches note bodies only when that finds fewer than 5 notes. \"fast\": titles and labels only. \"full\": always search note bodies too; on a large Trilium this can take seconds to minutes and blocks Trilium meanwhile. Queries using Trilium syntax (#label, note.*, title:, OR) always run as written."New value: +"\"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."
    • addedInput schema / properties / verbose
      Added value: +{
      +  "description": "Return full note metadata (child/branch IDs, blobId, UTC dates, isInheritable). Default false.",
      +  "type": "boolean"
      +}
  2. First observedv1.0.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/closed-world, and the description adds substantive behavior beyond them: metadata-only results, the exact returned fields, automatic fuzzy retry with searchMode:'fuzzy' and termsMatchedInTitleOrAttributes, partial:true meaning partial completion, truncated:true on overflow, and that 'full' strategy blocks the Trilium server. The only minor gap is no explicit statement about result ordering defaults or cost limits at the 10000 cap.

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

Conciseness4/5

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

Front-loaded with purpose, return shape, and the get_note alternative before the syntax reference; the bulleted grammar block is dense and each operator example is load-bearing. It is long, but the length is justified by a real query language — only marginal trimming (e.g. the id-token heuristic) would be possible without losing capability information.

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?

There is no output schema, so the description must describe returns — and it does: the metadata field list, verbose expansion, searchMode, termsMatchedInTitleOrAttributes, partial, truncated, and contentPreview. For a 13-parameter search tool with three enums and a custom query grammar, nothing an agent needs to call it correctly appears to be missing.

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 the baseline would be 3, but the description carries the entire Trilium query syntax that the `query` parameter's schema defers to ('see tool description for syntax') — AND/OR, label operators, title:, id:, property paths. It also adds semantic layering for ancestorNoteId/ancestorDepth and fuzzy/strategy interactions that go beyond the field 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?

Opens with a specific verb and resource ('Find notes by full-text and/or attribute filters') plus the exact return payload, and immediately distinguishes itself from get_note by stating it returns metadata only. An agent can tell this is a search/retrieval tool versus the sibling body-readers without opening the schema.

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?

Explicitly routes the agent: use get_note to read bodies, or set content_preview_chars for short previews to avoid a per-result get_note call. It also gives conditional guidance for fuzzy retry behavior, strategy selection, and ancestorNoteId + ancestorDepth for subtree scoping, covering when to reach for each mode rather than leaving it to inference.

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