search_files
Search a MemDrive memory library by keyword, ranking matches by relevance with path, heading, score, and highlighted snippet; filter by file type, tags, date, or exact phrase.
Instructions
Search the memory library by keyword, ranked by relevance (full-text index + BM25; Chinese queries are segmented, so 1–2 character terms match). Returns one hit per matching file (its best-matching chunk) with the file path, section heading, relevance score, and a snippet with the matched term highlighted as term. Filename matches are included too: a substring of a filename finds the file, including non-text files such as images. Results are paginated: limit defaults to 20, pass offset for the next page. Filters: file_types (e.g. [".md"]), tags (a file must carry at least one), date_from/date_to (file date: front matter > filename > modification time; a date-only upper bound covers the whole day), modified_after/modified_before (modification time). exact_phrase requires the phrase to appear verbatim. diagnostics_only returns a read-only library report (empty files, duplicate content, broken image references, unreferenced attachments older than 24h) and never modifies anything; keyword is not needed for it. rebuild_index forces a full index rebuild first (use after a bulk import or a cache clear). On the first search after startup the index may still be building in the background; the result then says so and falls back to a direct scan (keyword, path, and file types only — tags, dates, and exact_phrase are not applied there, and the result says so). Paths are relative to the library root (MEMDRIVE_ROOT). Omit path or pass "" to search the whole library.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "search_files"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Directory to search under, relative to the library root. Omit or pass "" for the whole library. | |
| tags | No | A file must carry at least one of these tags (YAML front matter `tags:` or body `#tag`). Omit for all. | |
| limit | No | Maximum files to return (default 20, max 200). | |
| offset | No | Files to skip for pagination (default 0). | |
| date_to | No | Latest file date (ISO date, e.g. "2026-12-31"). A date-only value covers that whole calendar day in the server's local timezone. | |
| keyword | No | Keyword to search for (case-insensitive; Chinese terms are segmented). Required unless diagnostics_only is true. | |
| date_from | No | Earliest file date (ISO date, e.g. "2026-01-01"). File date is front matter date, then filename date, then modification time. A date-only value means that calendar day in the server's local timezone. | |
| file_types | No | File extensions to include, e.g. [".md", ".txt"]. Omit for all types. | |
| exact_phrase | No | Phrase that must appear verbatim in a matching chunk (in addition to the keyword). | |
| rebuild_index | No | Force a full index rebuild before searching (default false). | |
| modified_after | No | Earliest modification time (ISO date). A date-only value means the start of that calendar day in the server's local timezone. | |
| modified_before | No | Latest modification time (ISO date). A date-only value covers that whole calendar day in the server's local timezone. | |
| diagnostics_only | No | Return the read-only library diagnostics report instead of searching (default false). |