Skip to main content
Glama

Delete media file

delete-media-file
DestructiveIdempotent

Previews Note, card template, and CSS references before moving a media file to Anki's trash, requiring a reviewed hash, reference count, fingerprint, and confirmation to apply.

Instructions

Previews exact Note, Card Template, and CSS references before moving one media file to Anki's media trash. Applying requires the reviewed file hash, reference count, reference fingerprint, and explicit confirmation. Incomplete Note or CSS scans block deletion even with confirmations enabled.

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": {
      "filename": "<filename>"
    },
    "name": "delete-media-file"
  }
}

Input Schema

NameRequiredDescriptionDefault
dryRunNoInspect exact bytes and all detectable references without deleting the file
filenameYesPortable filename inside Anki's flat collection.media folder
expectedSha256NoFile hash returned by the dry run; required when applying
confirmDeletionNoMust be true when applying media deletion
expectedReferenceCountNoReference count returned by the dry run; required when applying
confirmBrokenReferencesNoMust be true when applying deletion while Notes, Card Templates, or CSS still reference the file
expectedReferenceFingerprintNousage.referenceFingerprint returned by a complete dry run; required when applying, even if the reference count is unchanged

Output Schema

NameRequiredDescriptionDefault
fileYes
usageYes
dryRunYes
existsYes
appliedYes
blockersYes
filenameYes
warningsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, and idempotentHint=true, so the safety profile is covered. The description adds substantive context beyond that: the file goes to a trash rather than being erased outright, apply requires four corroborating values from the dry run, and incomplete scans hard-block the operation regardless of confirmations. It does not state retention or restoreability of the trash, which would complete the picture.

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?

Three dense sentences with the preview-then-apply sequence front-loaded and no filler. The closing clause 'even with confirmations enabled' is slightly awkward and could be tightened, but nothing is redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/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 covers the workflow, the apply preconditions, and the blocking rule for a seven-parameter destructive tool. The main remaining gap is what happens to a file in the media trash and whether it can be recovered, which matters for a destructive operation.

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 description coverage is 100%, so baseline is 3. The description goes slightly beyond per-field text by presenting expectedSha256, expectedReferenceCount, expectedReferenceFingerprint, and confirmDeletion as a single coherent apply contract tied to the reviewed dry run, reinforcing that they must come from that same review. It adds framing rather than new per-parameter meaning.

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?

The description states a specific verb and resource: it previews Note/Card Template/CSS references and then moves a single media file to Anki's media trash. That is clearly distinct from read-oriented siblings such as get-media-file and search-media-files, though no sibling is named explicitly. The two-phase nature (preview, then apply) is conveyed up front.

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?

It gives clear context for both modes: run the preview first, then apply only with the reviewed hash, count, fingerprint, and explicit confirmation. It also states an exclusion condition — incomplete Note or CSS scans block deletion even with confirmations. It stops short of naming an alternative tool, e.g. detach-media-from-notes for clearing references first.

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