Skip to main content
Glama

Update Media

update_media
DestructiveIdempotent

Edit an existing media record's caption, date, attributes, tags, notes, citations, or file, and attach it to people, families, events, places, sources, or citations.

Instructions

Change an existing media record's description, date, attributes or links to notes, tags and citations, or replace its file with filePath from the server's upload folder (GRAMPS_MEDIA_UPLOAD_DIRS) or, where the server allows it, with file attached in the chat. attachTo shows the media on people, families, events, places, sources or citations, whole or as a region; to take it off a record, use that record's update tool with mediaHandles and linkMode remove. For a new media record use create_media; to remove one, delete_object. Pass only what changes; omitted arguments stay as they are. Link lists (…Handles, …Refs) follow linkMode: replace (default) sets the whole list, add appends, remove drops the given handles; in replace mode [] REMOVES every link of that kind, though the linked records themselves stay in the tree. Returns the handle and Gramps ID; a missing media object returns a not-found message, and an unreadable date or file is rejected before anything is saved. Writes run one at a time and need a Gramps Web account allowed to edit the tree; a locked or rate-limited write fails with the delay to wait before retrying it. Formats of every argument: get_reference(topic: "input-guide").

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": {
      "handle": "<handle>"
    },
    "name": "update_media"
  }
}

Input Schema

NameRequiredDescriptionDefault
dateNoNew date. Omit to keep the current date; pass an empty string to remove it. Date text: 1856-07-20, 1920-05, 1920, 1 Jul 1919, about/before/after 1920, 1800-1850, between … and …; append the calendar for other calendars, e.g. 1856-07-20 (Julian). Unreadable dates are rejected.
handleYesThe media object to change. Handle or Gramps ID (e.g. I0001), resolved automatically; find it with search or list_objects.
attachToNoRecords to show the media on, each getting a link after its existing media: Gramps IDs (I0001, F0001, E0001, P0001, S0001, C0001) or handles of people, families, events, places, sources or citations. JSON array, one value, or a comma-separated string. To show only part of the image, such as one record on a page scan, give an object {"ref":"I0001","region":[left, top, right, bottom]} in place of the ID. A region is [left, top, right, bottom]: its edges in percent of the image width and height, 0 to 100, measured from the top-left corner; [10, 20, 60, 45] runs from 10% to 60% across and from 20% to 45% down. A record already showing the media keeps its link and takes the region; list a record twice to show two regions. Check a region with read_media first. The object may also carry "attributes" of the link (not of the media), such as ["Page: 12"]; a link already there gains the ones it lacks. Not affected by linkMode.
filePathNoReplace the stored file with this one: an absolute path inside an upload folder, ~/…, or a name relative to the folder. Accepts JPEG, PNG, GIF, WebP, TIFF, BMP or PDF, judged by content; a file another media record already holds is rejected. Give filePath or file; omit both to keep the file.
linkModeNoHow to apply all supplied link lists: replace (default) replaces each full list, and a link it keeps keeps its stored privacy, citations, notes and crop unless the call sends new values; add appends missing handles and preserves existing link metadata; remove removes all links matching supplied handles (reference metadata is ignored). Omitted lists stay unchanged; empty lists clear only in replace mode. Does not affect attributes, names, addresses or URLs. Use separate calls to add and remove, or replace to edit existing link metadata.replace
isPrivateNotrue makes the record private, false public. Omit to leave unchanged.
attributesNoAttributes. Omit to keep; a value replaces the whole list and [] clears it, whatever linkMode says. Attributes: JSON array of objects {type,value,...}, or strings "Type: Value" (first colon), or one string with lines or | between entries. A type must be a standard Gramps attribute type or a custom one the tree already uses; anything else is rejected with suggestions. Full grammar: gramps://input-guide.
tagHandlesNoTags. Omit to keep; applied per linkMode. Handles, not Gramps IDs: JSON array ["h1","h2"], one handle, or a comma/semicolon/newline-separated string; entries may also be objects {"ref":"…"}.
descriptionNoNew description (caption). Omit to leave unchanged.
noteHandlesNoNotes. Omit to keep; applied per linkMode. Handles, not Gramps IDs: JSON array ["h1","h2"], one handle, or a comma/semicolon/newline-separated string; entries may also be objects {"ref":"…"}.
citationHandlesNoCitations. Omit to keep; applied per linkMode. Handles, not Gramps IDs: JSON array ["h1","h2"], one handle, or a comma/semicolon/newline-separated string; entries may also be objects {"ref":"…"}.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.11.0
    • changedInput schema / properties / filePath / description
      Previous value: -"Replace the stored file with this one: an absolute path inside an upload folder, ~/…, or a name relative to the folder. Accepts JPEG, PNG, GIF, WebP, TIFF, BMP or PDF, judged by content; a file another media record already holds is rejected. Omit to keep the file."New value: +"Replace the stored file with this one: an absolute path inside an upload folder, ~/…, or a name relative to the folder. Accepts JPEG, PNG, GIF, WebP, TIFF, BMP or PDF, judged by content; a file another media record already holds is rejected. Give filePath or file; omit both to keep the file."
  2. Changed1 schema field changedv2.10.0
    • changedInput schema / properties / attachTo / description
      Previous value: -"Records to show the media on, each getting a link after its existing media: Gramps IDs (I0001, F0001, E0001, P0001, S0001, C0001) or handles of people, families, events, places, sources or citations. JSON array, one value, or a comma-separated string. To show only part of the image, such as one record on a page scan, give an object {\"ref\":\"I0001\",\"region\":[left, top, right, bottom]} in place of the ID. A region is [left, top, right, bottom]: its edges in percent of the image width and height, 0 to 100, measured from the top-left corner; [10, 20, 60, 45] runs from 10% to 60% across and from 20% to 45% down. A record already showing the media keeps its link and takes the region; list a record twice to show two regions. Check a region with read_media first. Not affected by linkMode."New value: +"Records to show the media on, each getting a link after its existing media: Gramps IDs (I0001, F0001, E0001, P0001, S0001, C0001) or handles of people, families, events, places, sources or citations. JSON array, one value, or a comma-separated string. To show only part of the image, such as one record on a page scan, give an object {\"ref\":\"I0001\",\"region\":[left, top, right, bottom]} in place of the ID. A region is [left, top, right, bottom]: its edges in percent of the image width and height, 0 to 100, measured from the top-left corner; [10, 20, 60, 45] runs from 10% to 60% across and from 20% to 45% down. A record already showing the media keeps its link and takes the region; list a record twice to show two regions. Check a region with read_media first. The object may also carry \"attributes\" of the link (not of the media), such as [\"Page: 12\"]; a link already there gains the ones it lacks. Not affected by linkMode."
  3. Changed2 schema fields changedv2.5.1
    • addedInput schema / properties / attachTo
      Added value: +{
      +  "default": null,
      +  "description": "Records to show the media on, each getting a link after its existing media: Gramps IDs (I0001, F0001, E0001, P0001, S0001, C0001) or handles of people, families, events, places, sources or citations. JSON array, one value, or a comma-separated string. To show only part of the image, such as one record on a page scan, give an object {\"ref\":\"I0001\",\"region\":[left, top, right, bottom]} in place of the ID. A region is [left, top, right, bottom]: its edges in percent of the image width and height, 0 to 100, measured from the top-left corner; [10, 20, 60, 45] runs from 10% to 60% across and from 20% to 45% down. A record already showing the media keeps its link and takes the region; list a record twice to show two regions. Check a region with read_media first. Not affected by linkMode."
      +}
    • addedInput schema / properties / filePath
      Added value: +{
      +  "default": null,
      +  "description": "Replace the stored file with this one: an absolute path inside an upload folder, ~/…, or a name relative to the folder. Accepts JPEG, PNG, GIF, WebP, TIFF, BMP or PDF, judged by content; a file another media record already holds is rejected. Omit to keep the file.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
  4. Changed1 schema field changedv2.3.2
    • changedInput schema / properties / attributes / description
      Previous value: -"Attributes. Omit to keep; a value replaces the whole list and [] clears it, whatever linkMode says. Attributes: JSON array of objects {type,value,...}, or strings \"Type: Value\" (first colon), or one string with lines or | between entries. Full grammar: gramps://input-guide."New value: +"Attributes. Omit to keep; a value replaces the whole list and [] clears it, whatever linkMode says. Attributes: JSON array of objects {type,value,...}, or strings \"Type: Value\" (first colon), or one string with lines or | between entries. A type must be a standard Gramps attribute type or a custom one the tree already uses; anything else is rejected with suggestions. Full grammar: gramps://input-guide."
  5. Changed1 schema field changedv2.3.1
    • changedInput schema / properties / linkMode / description
      Previous value: -"How to apply all supplied link lists: replace (default) replaces each full list; add appends missing handles and preserves existing link metadata; remove removes all links matching supplied handles (reference metadata is ignored). Omitted lists stay unchanged; empty lists clear only in replace mode. Does not affect attributes, names, addresses or URLs. Use separate calls to add and remove, or replace to edit existing link metadata."New value: +"How to apply all supplied link lists: replace (default) replaces each full list, and a link it keeps keeps its stored privacy, citations, notes and crop unless the call sends new values; add appends missing handles and preserves existing link metadata; remove removes all links matching supplied handles (reference metadata is ignored). Omitted lists stay unchanged; empty lists clear only in replace mode. Does not affect attributes, names, addresses or URLs. Use separate calls to add and remove, or replace to edit existing link metadata."
  6. Changed8 schema fields changedv2.3.0
    • changedInput schema / properties / attributes / description
      Previous value: -"Replace attributes. Omit to leave unchanged. For link lists, linkMode controls replace/add/remove; [] clears in replace mode and does nothing in add/remove. Other lists always use replacement. Attributes: JSON array of objects {type,value,...}, or strings \"Type: Value\" (first colon), or one string with lines or | between entries. Full grammar: gramps://input-guide."New value: +"Attributes. Omit to keep; a value replaces the whole list and [] clears it, whatever linkMode says. Attributes: JSON array of objects {type,value,...}, or strings \"Type: Value\" (first colon), or one string with lines or | between entries. Full grammar: gramps://input-guide."
    • changedInput schema / properties / citationHandles / description
      Previous value: -"Linked citations. Omit to leave unchanged. For link lists, linkMode controls replace/add/remove; [] clears in replace mode and does nothing in add/remove. Other lists always use replacement. Handles: JSON array [\"h1\",\"h2\"], a single handle as a plain string, comma/semicolon/newline-separated list, or a JSON-array string. Array entries may be strings or objects {\"ref\":\"…\"} / {\"handle\":\"…\"}."New value: +"Citations. Omit to keep; applied per linkMode. Handles, not Gramps IDs: JSON array [\"h1\",\"h2\"], one handle, or a comma/semicolon/newline-separated string; entries may also be objects {\"ref\":\"…\"}."
    • changedInput schema / properties / date / description
      Previous value: -"Date text. Omit to keep the current date; pass an empty string to remove it. Date format: use ISO dates (1990-03-15), year-only (1920), or modifiers (before 1920, about 1950). Add the calendar at the end for Old Style and other calendars: 1856-07-20 (Julian). See gramps://input-guide resource or call get_reference(topic: \"input-guide\", section: \"dates\") for full syntax."New value: +"New date. Omit to keep the current date; pass an empty string to remove it. Date text: 1856-07-20, 1920-05, 1920, 1 Jul 1919, about/before/after 1920, 1800-1850, between … and …; append the calendar for other calendars, e.g. 1856-07-20 (Julian). Unreadable dates are rejected."
    • changedInput schema / properties / description / description
      Previous value: -"Description. Omit to leave unchanged."New value: +"New description (caption). Omit to leave unchanged."
    • changedInput schema / properties / handle / description
      Previous value: -"Media handle. Handle or Gramps ID (e.g. I0001). Handles are opaque strings from the API. Gramps IDs (like I0001, F0023) are auto-resolved to handles. Find handles with search() or list_objects()."New value: +"The media object to change. Handle or Gramps ID (e.g. I0001), resolved automatically; find it with search or list_objects."
    • changedInput schema / properties / isPrivate / description
      Previous value: -"Private flag. Omit to leave unchanged."New value: +"true makes the record private, false public. Omit to leave unchanged."
    • changedInput schema / properties / noteHandles / description
      Previous value: -"Linked notes. Omit to leave unchanged. For link lists, linkMode controls replace/add/remove; [] clears in replace mode and does nothing in add/remove. Other lists always use replacement. Handles: JSON array [\"h1\",\"h2\"], a single handle as a plain string, comma/semicolon/newline-separated list, or a JSON-array string. Array entries may be strings or objects {\"ref\":\"…\"} / {\"handle\":\"…\"}."New value: +"Notes. Omit to keep; applied per linkMode. Handles, not Gramps IDs: JSON array [\"h1\",\"h2\"], one handle, or a comma/semicolon/newline-separated string; entries may also be objects {\"ref\":\"…\"}."
    • changedInput schema / properties / tagHandles / description
      Previous value: -"Linked tags. Omit to leave unchanged. For link lists, linkMode controls replace/add/remove; [] clears in replace mode and does nothing in add/remove. Other lists always use replacement. Handles: JSON array [\"h1\",\"h2\"], a single handle as a plain string, comma/semicolon/newline-separated list, or a JSON-array string. Array entries may be strings or objects {\"ref\":\"…\"} / {\"handle\":\"…\"}."New value: +"Tags. Omit to keep; applied per linkMode. Handles, not Gramps IDs: JSON array [\"h1\",\"h2\"], one handle, or a comma/semicolon/newline-separated string; entries may also be objects {\"ref\":\"…\"}."
  7. First observedv2.2.0

TDQS

A4.4/5.0
Behavior4/5

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

Adds substantial behavior beyond the annotations: writes are serialized, require a Gramps Web account with tree-edit rights, and locked/rate-limited writes return a retry delay; unreadable dates or files are rejected before saving; a missing object yields a not-found message. It also discloses the dangerous edge that replace mode with [] strips every link of that kind while the linked records survive, which goes well past destructiveHint=true. The one omission is any discussion of whether the file replacement leaves the old file on disk.

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 core action, then alternatives, then link semantics, then failure modes — a sensible ordering. The linkMode sentence set and the attachTo explanation overlap noticeably with the schema descriptions of those same parameters, which is the main source of bloat in an otherwise tight definition.

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 an 11-parameter destructive mutation with no output schema, it covers what is returned (handle and Gramps ID), what happens on failure, permission and concurrency constraints, and the empty-list deletion hazard. An agent has enough to call this correctly without consulting other documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the per-parameter descriptions already carry date formats, region geometry, file types, and the attributes grammar, so the description largely restates the linkMode contract. It does add cross-cutting value by framing linkMode as governing all supplied link lists at once and by stating that omitted arguments stay unchanged, but most of this is already present in the schema text.

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 ('Change an existing media record') and enumerates the mutable surfaces: description, date, attributes, links to notes/tags/citations, and file replacement. It is clearly separable from create_media and delete_object, which it names explicitly.

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 routing: new records go to create_media, removal to delete_object, and detaching from a person/family/etc. to that record's own update tool with mediaHandles and linkMode remove. It also tells the caller to pass only changed fields and points to get_reference for argument formats.

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