{"at":"2026-11-23T04:16:01.710Z","dir":"sent","era":"server_discover","message":{"id":1,"jsonrpc":"2.0","method":"server/discover","params":{"_meta":{"io.modelcontextprotocol/clientCapabilities":{},"io.modelcontextprotocol/clientInfo":{"name":"didrun-lab","version":"0.1.0"},"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}}
{"at":"2026-11-23T04:16:02.278Z","dir":"received","era":"server_discover","message":{"error":{"code":-32601,"message":"Method not found"},"id":1,"jsonrpc":"2.0"}}
{"at":"2026-11-23T04:16:02.428Z","dir":"sent","era":"initialize","message":{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"didrun-lab","version":"0.1.0"},"protocolVersion":"2025-11-25"}}}
{"at":"2026-11-23T04:16:03.012Z","dir":"received","era":"initialize","message":{"id":1,"jsonrpc":"2.0","result":{"capabilities":{"tools":{"listChanged":true}},"protocolVersion":"2025-11-25","serverInfo":{"name":"memdrive-mcp","version":"0.9.0"}}}}
{"at":"2026-11-23T04:16:03.012Z","dir":"sent","era":"initialize","message":{"jsonrpc":"2.0","method":"notifications/initialized"}}
{"at":"2026-11-23T04:16:03.012Z","dir":"sent","era":"initialize","message":{"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}}}
{"at":"2026-11-23T04:16:03.068Z","dir":"received","era":"initialize","message":{"id":2,"jsonrpc":"2.0","result":{"tools":[{"description":"List the immediate children (subfolders and files) of a directory inside the MemDrive memory library.\nReturns one line per entry with type, size, and modification time. Directories sort first.\nUse this to explore what is already stored before reading or saving.\nPaths are relative to the library root (MEMDRIVE_ROOT). Omit path or pass \"\" for the root. Absolute paths are accepted only when they stay inside the root.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"path":{"description":"Directory to list, relative to the library root. Omit or pass \"\" for the root.","type":"string"}},"type":"object"},"name":"list_directory"},{"description":"Search the memory library by keyword, ranked by relevance (full-text index + BM25; Chinese queries are segmented, so 1–2 character terms match).\nReturns 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.\nFilters: 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.\ndiagnostics_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).\nOn 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).\nPaths are relative to the library root (MEMDRIVE_ROOT). Omit path or pass \"\" to search the whole library.\nFiles under the top-level archive/ folder are excluded from search_files — whole-library search and an explicit path: \"archive\" search both return nothing for them — while list_directory still shows archive/ so archived files remain inspectable.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"date_from":{"description":"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.","type":"string"},"date_to":{"description":"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.","type":"string"},"diagnostics_only":{"description":"Return the read-only library diagnostics report instead of searching (default false).","type":"boolean"},"exact_phrase":{"description":"Phrase that must appear verbatim in a matching chunk (in addition to the keyword).","type":"string"},"file_types":{"description":"File extensions to include, e.g. [\".md\", \".txt\"]. Omit for all types.","items":{"type":"string"},"type":"array"},"keyword":{"description":"Keyword to search for (case-insensitive; Chinese terms are segmented). Required unless diagnostics_only is true.","type":"string"},"limit":{"description":"Maximum files to return (default 20, max 200).","maximum":200,"minimum":1,"type":"integer"},"modified_after":{"description":"Earliest modification time (ISO date). A date-only value means the start of that calendar day in the server's local timezone.","type":"string"},"modified_before":{"description":"Latest modification time (ISO date). A date-only value covers that whole calendar day in the server's local timezone.","type":"string"},"offset":{"description":"Files to skip for pagination (default 0).","maximum":9007199254740991,"minimum":0,"type":"integer"},"path":{"description":"Directory to search under, relative to the library root. Omit or pass \"\" for the whole library.","type":"string"},"rebuild_index":{"description":"Force a full index rebuild before searching (default false).","type":"boolean"},"tags":{"description":"A file must carry at least one of these tags (YAML front matter `tags:` or body `#tag`). Omit for all.","items":{"type":"string"},"type":"array"}},"type":"object"},"name":"search_files"},{"description":"CLIPBOARD FIRST — READ THIS BEFORE ANYTHING ELSE: When the user says to save a screenshot or an image from the clipboard — for example \"把截图存下来\", \"把剪贴板里的图存下来\", \"save the screenshot\", or any equivalent wording — pass images: [\"clipboard\"]. That is all it takes: the server reads the clipboard directly on the user's own machine. You do NOT need to see the clipboard or the image. NEVER ask the user to paste, upload, or send the image into the chat. NEVER say you cannot read the clipboard, that you cannot see images, or that this memory library can only store text. If the clipboard holds no image, the server reports that in the result and the text is still saved — tell the user to take the screenshot again and retry; do not invent a clipboard failure.\nInteraction rule — read before calling:\nBefore calling this tool, show the user the EXACT destination path and\nfilename you intend to write (for example: \"notes/2026-10-28.md\") and\nget their explicit confirmation in the chat. Never call save_file with\na path or filename the user has not confirmed. If the user has not\nconfirmed a location yet, ask them first instead of calling.\nThere is no popup or confirmation dialog: confirmation happens here,\nin the conversation, through you.\nSave text (usually Markdown) into the MemDrive memory library.\nModes: \"new\" (default) fails when the file already exists; \"overwrite\" replaces it; \"append\" adds to the end, creating the file when missing. Parent directories are created automatically.\nTags: two syntaxes are supported — YAML front matter `tags:` (inline `[a, b]` or block `- a`) and body `#tag`. Proactively suggest adding tags ONLY in these three cases: (1) the user mentions a category or topic while saving (e.g. saving a work plan); (2) the note clearly belongs to a tag already used in the library; (3) the user saves several notes on the same topic in a row (ask once, e.g. whether to tag all of them X). NEVER ask about tags for quick screenshot/clipboard saves, when the user only said \"save it\" with no topic signal, or after you already asked once in this conversation and the user ignored it or said no. When the user explicitly asks to save with tags, just save with those tags — none of the rules above apply. If the tool result includes a `Tip:` line about tagging, you MUST say that tip to the user.\nImages: pass an \"images\" array with any mix of the literal string \"clipboard\" (capture the latest screenshot from the OS clipboard — see the clipboard rule above), local file paths, or http(s) image URLs. Images are copied/downloaded/captured into a sibling assets/ folder, renamed \"<document-name>-<timestamp>.<ext>\", and for Markdown files a standard image reference is appended to the document automatically. The on-disk original is always kept at full quality; only the preview handed to a model is ever downscaled.\nClipboard behavior: when the clipboard is empty or holds text instead of an image, the text is still saved and the result explains what to do (re-screenshot). Clipboard capture never crashes the server; in headless environments it reports itself as unsupported and suggests a file path or URL instead.\nPaths are relative to the library root (MEMDRIVE_ROOT). Absolute paths are accepted only when they stay inside the root. The root is a hard sandbox: \"../\" escapes and symlinks pointing outside are rejected.\nPath cleaning: surrounding quotes are stripped, a leading ~ expands to the home directory, and separators are normalized.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"content":{"description":"Text content to save (usually Markdown).","type":"string"},"images":{"description":"Images to archive with the document — CLIPBOARD FIRST: the literal string \"clipboard\" captures the latest screenshot/image from the OS clipboard on the machine running the server. Use it whenever the user mentions a screenshot or the clipboard: never ask them to paste the image into the chat, and never claim the clipboard cannot be read. Local file paths and http(s) image URLs are also accepted.","items":{"type":"string"},"type":"array"},"mode":{"description":"Write mode: \"new\" (default, fails if the file exists), \"overwrite\", or \"append\".","enum":["new","overwrite","append"],"type":"string"},"path":{"description":"Destination file path, relative to the library root (for example \"notes/2026-10-28.md\"). Must be confirmed with the user before calling.","minLength":1,"type":"string"}},"required":["path","content"],"type":"object"},"name":"save_file"},{"description":"Edit the tags on an existing note: add one tag, remove one tag, or rename one tag. One operation per call.\nTags live in two places: YAML front matter `tags:` (inline `[a, b]` or block `- a`) and body `#tag`s. The location parameter picks which one to edit (default front_matter).\nOnly the tag lines change: the rest of the file is left byte-for-byte identical (no reflow, no other front-matter field touched). Adding a tag to a note with no front matter creates a minimal `---\\ntags: [tag]\\n---` block at the top; adding a body tag appends `#tag` on its own line at the end of the file.\nNo-ops are not errors: adding a tag that is already there, removing one that is not there, and renaming to a name that already exists all succeed with a \"No change\" result. Tag names are case-insensitive.\nThe search index is updated at once, so the note is searchable by its new tags immediately.\nPaths are relative to the library root (MEMDRIVE_ROOT). Absolute paths are accepted only when they stay inside the root. The root is a hard sandbox: \"../\" escapes and symlinks pointing outside are rejected.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"location":{"description":"Which tag syntax to edit: \"front_matter\" (default, YAML `tags:`) or \"body\" (`#tag`s in the text).","enum":["front_matter","body"],"type":"string"},"new_tag":{"description":"Required for \"rename\": the new tag name. Ignored for \"add\" and \"remove\".","type":"string"},"operation":{"description":"One operation per call: \"add\" adds tag, \"remove\" removes tag, \"rename\" renames tag to new_tag.","enum":["add","remove","rename"],"type":"string"},"path":{"description":"Note to edit, relative to the library root (for example \"notes/2026-10-28.md\").","minLength":1,"type":"string"},"tag":{"description":"The tag to add, remove, or rename (without the leading \"#\").","minLength":1,"type":"string"}},"required":["path","operation","tag"],"type":"object"},"name":"edit_tags"},{"description":"Move a file into the top-level `archive/` folder, preserving its relative path (`notes/foo.md` becomes `archive/notes/foo.md`).\nArchiving is recoverable and is the default way to retire old or superseded files instead of deleting them. Use `restore_file` to move an archived file back.\nFiles in `archive/` are excluded from `search_files`, while `list_directory` still shows `archive/` so archived files remain inspectable.\nRefuses to overwrite if the destination under `archive/` already exists, and rejects directories, missing files, `archive/` itself, or files already inside `archive/`.\nPaths are relative to the library root (MEMDRIVE_ROOT). Absolute paths are accepted only when they stay inside the root. The root is a hard sandbox: \"../\" escapes and symlinks pointing outside are rejected.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"path":{"description":"File to archive, relative to the library root (for example \"notes/2026-10-28.md\").","minLength":1,"type":"string"}},"required":["path"],"type":"object"},"name":"archive_file"},{"description":"Restore an archived file from the top-level `archive/` folder back to its original path (for example `archive/notes/foo.md` becomes `notes/foo.md`).\nThe search index is updated immediately so the restored file is searchable again.\nRefuses to overwrite if a file already exists at the original path, and rejects directories, missing files, or paths not inside `archive/`.\nPaths are relative to the library root (MEMDRIVE_ROOT). Absolute paths are accepted only when they stay inside the root. The root is a hard sandbox: \"../\" escapes and symlinks pointing outside are rejected.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"path":{"description":"Archived file to restore, relative to the library root — must start with \"archive/\" (for example \"archive/notes/2026-10-28.md\").","minLength":1,"type":"string"}},"required":["path"],"type":"object"},"name":"restore_file"},{"description":"Generate a read-only cleanup plan for the library (two-step confirmation). Scans the library and proposes file actions — archiving empty files, duplicate files and orphan attachments — but changes nothing.\nReturns a plan ID and a human-readable preview. The plan is also saved as JSON in the per-library cache dir (plan-<id>.json) for the `apply_plan` tool or the `memdrive-mcp apply <plan-id>` command.\nEmpty files, duplicates and orphan attachments are all proposed for archiving (recoverable); nothing is ever permanently deleted. Broken image references are listed as notes, not actions. Similar content is never proposed — only exact SHA-256 duplicates.\nThis tool never modifies any file.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{},"type":"object"},"name":"plan_cleanup"},{"description":"Execute a cleanup plan created by plan_cleanup, by its plan ID. Archives each action in the plan (empty files, duplicate files, orphan attachments) after re-verifying it; nothing is ever permanently deleted.\nBefore executing, each action is re-verified against the library: the path must still exist, the SHA-256 and modification time must match the plan, and the reason must still hold (empty file still empty, duplicate group still intact, orphan still unreferenced). Actions that no longer hold are skipped with the reason, and the rest still execute.\nPlans older than 7 days are rejected. A plan ID that does not exist or is malformed is reported, and nothing is changed. The search index is rebuilt after execution.\nUse this when the user asks to execute a plan in chat (for example \"执行这个清理计划\"). The command-line `memdrive-mcp apply <plan-id>` does the same thing from a terminal.\nNever call this tool automatically right after plan_cleanup. Always show the user the plan preview and plan ID first and wait for their explicit confirmation in the chat before calling.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"plan_id":{"description":"Plan ID returned by plan_cleanup (for example \"20261114054412-c4ad79\").","minLength":1,"type":"string"}},"required":["plan_id"],"type":"object"},"name":"apply_plan"},{"description":"Read a file from the MemDrive memory library.\nTOTAL RESPONSE BUDGET — THREE LIMITS ON THREE DIFFERENT LAYERS. (1) HOST: the MCP host rejects a whole tool result over about 1 MB (\"Tool result is too large. Maximum size is 1MB\"), a host limit outside this server and separate from the model context window. (2) SERVER: text bytes plus base64 image bytes in one response must fit a single total budget — default 950,000 bytes, overridable with MEMDRIVE_RESPONSE_BUDGET_BYTES (clamped to 100,000–50,000,000). Text is guaranteed first; images share what remains and are downscaled in memory (trying higher JPEG quality before shrinking dimensions) or skipped with a note so a read never fails over an image and the file on disk is never modified. read_file returns a preview that fits the budget; to view the original image on disk, use open_image (only when the user asks). (3) MODEL: the model converts image pixels into tokens under its own limits, unrelated to the byte limits above.\nTWO-STEP READING — USE THIS WHENEVER A DOCUMENT REFERENCES SEVERAL IMAGES, OR ONE LARGE IMAGE: Step 1, call read_file with include_images=false to read the text and get the list of referenced image paths. Step 2, call read_file once per referenced image, passing that image path itself as path, so the image alone gets the whole response budget and keeps the best quality the budget allows. Reading an image file directly is also limited by the same total budget: a single image is returned untouched when it fits, and downscaled in memory only when the image itself exceeds the budget.\nText files: returned as text (truncated at the smaller of the 1 MB text cap and the total budget, with a note when truncated).\nMarkdown files: with include_images=true (the default), the text is returned TOGETHER WITH every locally-referenced image that fits the remaining budget in the same response — each image becomes an image content block, so the model sees words and pictures together. Remote (http) and data: images are skipped with a note. Images over the 3.5 MB preview cap are downscaled in memory only; the file on disk is never modified.\nImage files: returned as a single image content block (downscaled in memory only when over the preview cap or the total budget). If an image cannot be fitted within the budget at all, the result is text explaining that, not an error — the original is untouched.\nSVG files are returned as text (they are XML), never as image blocks.\nPaths are relative to the library root (MEMDRIVE_ROOT). Absolute paths are accepted only when they stay inside the root.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"include_images":{"description":"For Markdown files: true (default) returns the text together with its referenced images, within the total response budget; false returns text only plus the list of referenced image paths (step 1 of two-step reading). Ignored for non-Markdown files.","type":"boolean"},"path":{"description":"File to read, relative to the library root (for example \"notes/2026-10-28.md\").","minLength":1,"type":"string"}},"required":["path"],"type":"object"},"name":"read_file"},{"description":"Open an image file from the MemDrive memory library in the operating system's default image viewer (Photos on Windows/macOS, the default viewer on Linux), at full original quality.\nUSE ONLY WHEN THE USER EXPLICITLY ASKS TO VIEW THE ORIGINAL IMAGE — for example \"open this image\", \"show me the original\", or \"在系统里打开这张图\". NEVER call open_image automatically after a read_file, a save_file, or any other tool call, and never open an image the user has not asked to view. Opening a viewer window is a visible side effect on the user's screen; the model must not cause it unprompted.\nThe image itself is never returned to the model: the result is only a short text confirmation (or a note when no viewer is available, for example on a headless machine). To see the picture in the conversation, use read_file on the image path instead.\nOnly image files inside the library root can be opened. Non-image files, directories, missing files, and paths escaping the root are rejected with a note. The file on disk is never modified.\nPaths are relative to the library root (MEMDRIVE_ROOT). Absolute paths are accepted only when they stay inside the root.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"path":{"description":"Image file to open, relative to the library root (for example \"notes/assets/shot-20261028-120000-000.png\"). Only call this when the user explicitly asked to view the original image.","minLength":1,"type":"string"}},"required":["path"],"type":"object"},"name":"open_image"},{"description":"Open the folder containing a file or directory from the MemDrive memory library in the operating system's file manager (Explorer on Windows, Finder on macOS, the default file manager on Linux). A file opens its parent folder; a folder opens itself; an empty path opens the whole library root. The folder is opened without highlighting or selecting any file.\nUSE ONLY WHEN THE USER EXPLICITLY ASKS TO OPEN THE FOLDER — for example \"open the folder\", \"show me this note in the file manager\", or \"在系统里打开这个笔记所在的文件夹\". NEVER call open_containing_folder automatically after a read_file, a save_file, or any other tool call, and never open a folder the user has not asked to open. Opening a file manager window is a visible side effect on the user's screen; the model must not cause it unprompted.\nThe folder contents are never returned to the model: the result is only a short text confirmation naming the folder that was opened (or a note when no file manager is available, for example on a headless machine). To see what is in the folder, use list_directory instead.\nOnly paths inside the library root can be opened. Missing paths and paths escaping the root are rejected with a note. Nothing is modified.\nPaths are relative to the library root (MEMDRIVE_ROOT). Absolute paths are accepted only when they stay inside the root.","execution":{"taskSupport":"forbidden"},"inputSchema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"path":{"description":"File or folder whose containing folder to open, relative to the library root (for example \"notes/2026-10-28.md\" opens \"notes\"). Omit or pass \"\" to open the library root. Only call this when the user explicitly asked to open the folder.","type":"string"}},"type":"object"},"name":"open_containing_folder"}]}}}
