Skip to main content
Glama
ianderso
by ianderso

attach_media

Links an image or document to a person, event, or source, either by uploading a new file or reusing an existing Media object to avoid duplicate media.

Instructions

Attach an image or document to an object -- a new upload, or one already in the tree.

With file_path, the bytes are uploaded into the tree's managed media directory (so don't point at files you don't want copied); if that exact file is already present it is reused rather than duplicated. With media_ref, an existing Media object is linked.

One image should be ONE Media object, linked from each object it belongs to and cited once per fact it proves. Uploading the same photograph separately for the husband and the wife creates duplicates that have to be unpicked later. The write is verified afterwards: verified: false means nothing attached, whatever the rest of the result says.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesObject handle/gramps_id to attach media to.
file_pathNoAbsolute path to a local image, PDF, audio or video file to upload. Use this OR media_ref.
media_refNoHandle or gramps_id of a Media object ALREADY in the tree. Prefer this when the same document supports several people.
descriptionNoWhat the document IS, in archival terms. Only used when uploading a new file.
target_typeNoType of the target object: 'person', 'event', 'source', etc.person

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only declare the coarse safety profile (not read-only, not destructive, not idempotent); the description adds genuinely non-obvious behavior: bytes are copied into the tree's managed media directory, an already-present identical file is reused rather than duplicated, and the write is post-verified with `verified: false` meaning nothing attached. That last point is critical signal beyond any structured field.

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?

The core action is front-loaded in the first line, and each paragraph carries a distinct payload (upload semantics, linking semantics, duplicate warning + verification). The "ONE Media object... cited once per fact" passage is somewhat discursive, but it earns its place as anti-pattern guidance.

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 mutation tool with no output schema, the description compensates by explaining the return signal (`verified: false`) and the dedup/verification behavior. Combined with annotations covering the safety profile, an agent has enough to invoke it correctly and interpret the result.

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?

With 100% schema coverage the baseline is 3, but the description adds meaning beyond the schema: it frames file_path/media_ref as mutually exclusive choices, explains the dedup side effect of file_path, and states the reuse preference for media_ref. The "Use this OR media_ref" framing and dedup semantics are not in the schema prose.

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 precise verb+resource ("Attach an image or document to an object") and enumerates its two operating modes: upload via file_path, link via media_ref. It does not name the sibling it differs from (add_media vs. attach/link), so sibling routing is left to inference rather than stated.

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 explicit when-to-use conditions for each mode: file_path when uploading bytes, media_ref "when the same document supports several people." Also supplies a caution ("don't point at files you don't want copied") and a strong anti-pattern (uploading the same photo separately for husband and wife creates duplicates). This is real conditional guidance, not vague context.

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