Skip to main content
Glama
ianderso
by ianderso

attach_media

Link an image or document to any person, event, or source in a Gramps tree by uploading a new file or reusing an existing Media object; one item per image prevents duplicates.

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.3/5.0
Behavior5/5

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

With annotations already covering safety (readOnlyHint=false, destructiveHint=false), the description still adds substantial behavioral context beyond them: the file is copied into the tree's managed media directory ('don't point at files you don't want copied'), an identical existing file is reused rather than duplicated, and the write is verified afterwards with 'verified: false' meaning nothing attached. That verification semantics is essential since there is no output schema.

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 purpose is front-loaded in the first sentence and the mode split follows immediately, so the agent gets the key decision first. The remaining sentences mostly earn their place (side effect, dedup, verification), though the duplicate-upload anecdote and parenthetical asides make it slightly longer than necessary.

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, it covers the essentials: side effects (file copy), dedup/reuse behavior, mode selection, the mutual exclusivity of file_path and media_ref, and how to interpret the verification result. Nothing an agent needs to call this correctly appears to be 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 description coverage is 100%, so the baseline is 3, and the description adds real meaning on top: it explains that file_path causes bytes to be uploaded into the managed media directory with dedup behavior, and that media_ref links an already-existing Media object. It also reinforces the mutual exclusivity of the two parameters, going slightly beyond the schema's own wording.

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 names a specific verb and resource ('Attach an image or document to an object') and explicitly splits the operation into two modes: a new upload via file_path, or linking an existing Media object via media_ref. It is very clear on what it does, but it never distinguishes itself from the sibling tool add_media, which an agent could easily confuse with attach_media.

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 in-context guidance for choosing between the two modes ('With file_path... With media_ref...') and adds an operational warning about duplicate uploads ('Uploading the same photograph separately for the husband and the wife creates duplicates'). However, it never names an alternative tool or states when not to use this one, so the routing burden against siblings like add_media/update_media is left to inference.

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