Skip to main content
Glama

Bookmark

media_bookmark
Destructive

Write and edit persistent bookmarks, outlines, or chapters in local PDFs, videos, audio, and images, saving PDF outlines in-file plus sidecar VTT/JSON files for later sessions.

Instructions

Write bookmarks (an outline, chapters) into a local media file so they survive across sessions and are visible to humans in the file itself: the PDF outline for a PDF, a sidecar VTT for video/audio, and a sidecar JSON for every supported media type. (写入书签 / 目录 / 章节:PDF 改写文件自带目录;视频、音频写同名 .mmgrep.bookmark.vtt; 所有类型都写 .mmgrep.bookmark.json 侧车。中文触发词:书签、目录、章节、bookmark、outline、chapter。)

The sidecar ".mmgrep.bookmark.json" is the single source of truth. The first write (no sidecar yet) imports the file's own outline — PDF bookmarks, or video/audio chapter markers — as b1…bN in file order, then applies this call. New ids are max+1 and are never reused; update keeps the id. One call can mix add / remove / update; they are applied remove → update → add, all-or-nothing: if anything is invalid, nothing is written and every problem is listed at once (unknown id, bad field, page/time out of range, duplicate ids, malformed entry, …). An image has no native outline and gets the sidecar only; text and Office documents are not supported.

WARNING — this tool modifies files:

  • A PDF's outline is rewritten IN PLACE: the PDF file itself is modified in place, no copy is made.

  • Files are written NEXT TO the source: a .mmgrep. sidecar for every media type, plus *.mmgrep.bookmark.vtt for video/audio. They are not written into the cache directory.

  • When a sidecar already exists, external edits to the file's own outline are OVERWRITTEN on the next write.

  • Protect your originals with git (or a backup) before calling this tool.

After the write, media_probe / media_overview / media_locate show this outline (ids b1…bN) instead of the file's native one. The result contains the full outline, the sidecar path, the embed target, and every check result. (书签 / 目录 / 章节 / bookmark / outline / chapter)

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": {
      "path": "<path>"
    },
    "name": "media_bookmark"
  }
}

Input Schema

NameRequiredDescriptionDefault
addNoEntries to add. Each gets a new id (max+1); do not pass "id". (新增书签:title + page(PDF)或 start/end(视频/音频))
pathYesAbsolute path to a LOCAL file: video, audio recording, or document. URLs and relative paths are rejected — this server never downloads anything. (本地文件绝对路径)
removeNoBookmark ids to remove, e.g. ["b2"]. Unknown or duplicate ids are errors and nothing is written. (删除书签:b1、b2 …)
updateNoEntries to update: pass "id" plus at least one of title / page / start / end / level. The id never changes. (更新书签:保留 id,只改字段)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A4.3/5.0
Behavior5/5

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

Goes far beyond the destructiveHint/readOnlyHint annotations: it discloses that a PDF outline is rewritten in place with no copy, that files are written next to the source rather than into a cache directory, that external edits to a native outline are overwritten once a sidecar exists, and that external edits are lost. It also documents the transactional model (one call may mix add/remove/update, applied remove → update → add, all-or-nothing with all errors reported at once) and the id lifecycle (max+1, never reused).

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-loads the one-line purpose, then a clearly delimited WARNING block, then the transactional semantics — a structure an agent can scan quickly. It is somewhat long, and the trailing parenthetical restating the Chinese trigger words (书签 / 目录 / 章节 / bookmark / outline / chapter) duplicates text already given earlier, but nothing is genuinely misleading.

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?

For a destructive, no-output-schema mutation tool, it covers the full picture: supported and unsupported media types, where writes land, what gets overwritten, atomicity guarantees, and even what the result returns (full outline, sidecar path, embed target, check results). An agent has enough to call this safely without probing further.

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 is 3; the description earns more by adding semantics the schema cannot express — that the first write imports the native outline as b1…bN in file order, that new ids are max+1 and never reused, and that update preserves the id. The ordering and all-or-nothing validation rules clarify how the add/remove/update arrays interact, which is genuine meaning beyond the field-level descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Write bookmarks (an outline, chapters) into a local media file") and enumerates exactly where the data lands per media type: PDF outline in-file, sidecar VTT for video/audio, sidecar JSON for all. It implicitly separates itself from the read-only siblings (media_probe/media_overview/media_locate) by saying they will display this outline afterwards, but it never explicitly contrasts itself with the closest sibling, media_annotate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear triggering conditions (bookmarks that must survive across sessions and be visible to humans in the file) plus explicit exclusions: "An image has no native outline and gets the sidecar only; text and Office documents are not supported." It also supplies a prerequisite-style warning to git-protect originals first. It does not name an alternative tool for the annotation use case, so routing between media_bookmark and media_annotate is still left to inference.

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