Skip to main content
Glama

Repair wrong metadata

fix_metadata
Destructive

Repairs films and series whose Jellyfin or Plex metadata does not match the file on disk, previewing re-identification against TVDB or TMDB before applying confirmed metadata replacement.

Instructions

Repairs films and series whose Jellyfin or Plex metadata does not describe the file on disk (a file Episode 101 shown as S1E1 with another title). Not trigger_scan, which never replaces a wrong title. Give a title as query, or the id get_metadata_issues printed. The preview lists numbering findings (confident) and title findings (advisory); a film is judged on year and title. Destructive: re-identifies the item against TVDB or TMDB and replaces all its metadata, hand edits included, with no undo on Jellyfin. Locked fields are never overwritten. When the preview says a refresh cannot move the episodes, use trigger_scan action: "rename" on the Sonarr series, then a media-server rescan. On Jellyfin the repair holds the request open a long time: do not retry. A Grimmory book is grimmory:<book id>, matched by ISBN or title and author. Previews first; confirm to apply. Field reference: arr://docs/fix_metadata.

Input Schema

NameRequiredDescriptionDefault
idNoThe media server item id, as get_metadata_issues prints it (`plex:119962`) or bare, or a Grimmory book as `grimmory:<book id>`. Wins over `query`.
isbnNoBooks only: search Grimmory's providers by this ISBN instead of the book's own.
userNoWhose view of the library to read the episodes through. Defaults to the media server's default_user; on Jellyfin, naming anyone else needs services.jellyfin.allow_other_users.
queryNoA film or series title. Resolved through the library index, the same way get_media_details resolves one.
confirmNoThe token from this tool's preview, passed back verbatim to apply it. Single-use and bound to the previewed arguments.
dry_runNoPreview without a confirm token, for "what would happen if" questions; not the first step of a real change.

Output Schema

NameRequiredDescriptionDefault
noopYes
tierYes
toolYes
resultNo
targetYes
appliedYes
dry_runYes
effectsYes
serviceYes
summaryYes
audit_idNo
warningsNo
operationYes
uncheckedNo
next_stepsNo
permissionYes
confirm_errorNo
confirm_tokenNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed17 schema fields changedv1.74.0
    • removedInput schema / $schema
      Removed value: -"https://json-schema.org/draft/2020-12/schema"
    • changedInput schema / properties / confirm / description
      Previous value: -"The confirmation token from this same tool's preview of this same operation. Omit it to get a preview and a token; pass the token back verbatim to apply the change. Tokens are single-use, expire, and are bound to the exact operation and arguments previewed."New value: +"The token from this tool's preview, passed back verbatim to apply it. Single-use and bound to the previewed arguments."
    • changedInput schema / properties / dry_run / description
      Previous value: -"Preview only: resolve the target and describe exactly what would happen, then stop. Never mutates anything and never returns a confirmation token. Use this to answer \"what would happen if…\" — not as the first step of actually doing it."New value: +"Preview without a confirm token, for \"what would happen if\" questions; not the first step of a real change."
    • removedOutput schema / $schema
      Removed value: -"https://json-schema.org/draft/2020-12/schema"
    • removedOutput schema / properties / applied / description
      Removed value: -"Whether the change actually happened. False on every preview, refusal and no-op."
    • removedOutput schema / properties / audit_id / description
      Removed value: -"The audit row this call wrote. Every branch writes one, including previews and refusals."
    • removedOutput schema / properties / confirm_error / description
      Removed value: -"Why a presented token was rejected. Present only when one was presented."
    • removedOutput schema / properties / confirm_token / description
      Removed value: -"Present when a preview is awaiting confirmation. Single-use, expiring, bound to this exact operation and arguments."
    • removedOutput schema / properties / dry_run / description
      Removed value: -"Whether this was an explicit preview."
    • removedOutput schema / properties / effects / description
      Removed value: -"Itemised consequences, most severe first. Empty is legitimate for a no-op."
    • removedOutput schema / properties / next_steps / description
      Removed value: -"Present on an applied write when another call is worth offering. Offer it to the person; do not run it."
    • removedOutput schema / properties / noop / description
      Removed value: -"True when the request resolved but there was nothing to do — already monitored, already approved."
    • removedOutput schema / properties / result / description
      Removed value: -"Whatever the service returned, on a write that landed."
    • removedOutput schema / properties / summary / description
      Removed value: -"One sentence, safe to show a human."
    • removedOutput schema / properties / target / description
      Removed value: -"The resolved id the write acts on — what the confirmation token is bound to."
    • removedOutput schema / properties / unchecked / description
      Removed value: -"Present when a service could not be asked, so its absence from `warnings` means nothing."
    • removedOutput schema / properties / warnings / description
      Removed value: -"Present on a preview when another service has something to say about this change. Tell the user before confirming."
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare destructiveHint=true, and the description goes well past that: it names what is replaced (all metadata, hand edits included), that there is no undo on Jellyfin, that locked fields are never overwritten, and that the Jellyfin repair holds the request open so it must not be retried. That is exactly the operational context the boolean hint cannot convey.

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?

Dense and front-loaded: purpose first, then the exclusion, then the destructive warning, then edge-case recovery. It is packed close to the limit of readability and ends with a docs pointer, but every sentence carries distinct information and none is filler.

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?

An output schema exists, so return values need not be explained, and the description instead supplies the parts the schema cannot: preview classification of `numbering` versus `title` findings, how films are judged, the no-retry constraint, and the rename-then-rescan fallback. Nothing an agent needs to call this safely and correctly is 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 is 3, but the description adds resolution logic the schema only partly carries: title goes in `query`, or the id that get_metadata_issues printed, and books are addressed as `grimmory:<book id>` matched by ISBN or title-and-author. It does not elaborate on `user`, `dry_run`, or `confirm` beyond what the schema already documents, so it is not fully additive.

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?

States a specific verb and resource ("Repairs films and series whose Jellyfin or Plex metadata does not describe the file on disk") and makes the failure mode concrete with the `Episode 101` shown as S1E1 example. It explicitly separates itself from `trigger_scan` and points at `get_metadata_issues` for id sourcing, so an agent can route correctly without opening another 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?

Gives the when (metadata doesn't match the file), the when-not ("Not trigger_scan, which never replaces a wrong title"), the sequencing ("Previews first; confirm to apply"), and a conditional alternative path (use trigger_scan `action: "rename"` on the Sonarr series plus a rescan when a refresh cannot move episodes). It also covers the book case with the `grimmory:<book id>` form.

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