Skip to main content
Glama
ianderso
by ianderso

query_objects

Read-only

Query Gramps objects with server-side GrampsQL filters to audit citations, sources, media, and other records without pulling whole collections.

Instructions

Query any collection with a server-side filter. The workhorse for audits.

Use this instead of fetching a collection and filtering it yourself: whole-collection pulls are slow on any real tree, and the filter runs in the database. Typical audit questions it answers directly:

  • uncited high-confidence claims: citations where confidence >= 3 AND page = ""

  • documents with no image: sources where media_list.length = 0

  • anonymous media: media where desc = ""

  • a URL anywhere: urls.any.path ~ "blm.gov"; a list is searched through its items, never with ~ on the list itself

To ask "what cites this source?" use get_backlinks -- a source has no citation_list, because citations point at IT, and reading citation_list on a source reports zero for every source in the tree.

Private records and living people come back as redacted stubs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gqlNoGrampsQL filter, applied server-side over the RAW object JSON. Single '=' for equality (NOT '=='), '~' for substring, '<list>.length' for sizes, combined with AND/OR. Examples: 'confidence >= 3 AND page = ""' (high-confidence citations with no locator), 'media_list.length = 0' (sources with no image), 'desc = ""' (undescribed media), 'description ~ "1871"'. A LIST is searched through its items with '.any.' (or '.all.'), and a handle followed with 'get_<type>': 'urls.any.path ~ "blm.gov"', 'attribute_list.any.value ~ "x"', 'note_list.any.get_note.text.string ~ "x"'. '~' on the list itself asks whether the value IS an item, so it is refused. TRAPS: a field the object lacks is not an error, it matches nothing -- event 'type' is one (use query_records). Booleans compare as 0/1: 'private = 1', never 'private = true'. A query reads the whole collection, so each OR'd condition adds time.
keysNoComma-separated fields to return, e.g. 'gramps_id,title,media_list'. Strongly recommended -- whole objects are large. NEVER build a write payload from a keys= result: writes replace the whole record.
pageNoPage of results, 1-based.
sortNoSort key; prefix '-' for descending (e.g. '-change').
limitNoMax rows to return.
handlesNoFetch these specific handles in one request.
gramps_idsNoFetch these specific gramps_ids (e.g. ['S0001','S0002']).
object_typeYesOne of: person, family, event, place, source, citation, repository, media, note, tag.
include_privateNoShow living people and private records in full. Only when the user asks for them; they are withheld by default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.3.0
    • changedInput schema / properties / gql / description
      Previous value: -"GrampsQL filter, applied server-side over the RAW object JSON. Single '=' for equality (NOT '=='), '~' for substring, '<list>.length' for sizes, combined with AND/OR. Examples: 'confidence >= 3 AND page = \"\"' (high-confidence citations with no locator), 'media_list.length = 0' (sources with no image), 'desc = \"\"' (undescribed media), 'description ~ \"1871\"'. TRAPS: a field the object lacks is not an error, it matches nothing -- event 'type' is one (use query_records). Booleans compare as 0/1: 'private = 1', never 'private = true'."New value: +"GrampsQL filter, applied server-side over the RAW object JSON. Single '=' for equality (NOT '=='), '~' for substring, '<list>.length' for sizes, combined with AND/OR. Examples: 'confidence >= 3 AND page = \"\"' (high-confidence citations with no locator), 'media_list.length = 0' (sources with no image), 'desc = \"\"' (undescribed media), 'description ~ \"1871\"'. A LIST is searched through its items with '.any.' (or '.all.'), and a handle followed with 'get_<type>': 'urls.any.path ~ \"blm.gov\"', 'attribute_list.any.value ~ \"x\"', 'note_list.any.get_note.text.string ~ \"x\"'. '~' on the list itself asks whether the value IS an item, so it is refused. TRAPS: a field the object lacks is not an error, it matches nothing -- event 'type' is one (use query_records). Booleans compare as 0/1: 'private = 1', never 'private = true'. A query reads the whole collection, so each OR'd condition adds time."
  2. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint; the description goes well beyond them, disclosing that filter cost scales with OR'd conditions, that missing fields silently match nothing (with 'event type' as a named trap), boolean 0/1 comparison rules, and that private records/living people return as redacted stubs. This is substantive behavioral context, not restatement.

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-loaded with purpose and the key when-to-use sentence, then organized into scannable bullets and a caveat paragraph. It is long and the gql examples partially duplicate the schema, but nearly every line is actionable.

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 nine-parameter query tool with no output schema, the description covers usage routing, redaction behavior, performance characteristics, and query pitfalls, while pagination/limit semantics live in the schema. Nothing essential to calling it correctly is missing.

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 description coverage is 100%, so the schema already documents all nine parameters, including the GrampsQL syntax, '.any.' list semantics, TRAPS, and the include_private caution. The description's gql section largely repeats that material, so the baseline 3 is appropriate.

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 ('Query any collection with a server-side filter') plus its role ('the workhorse for audits'). It distinguishes itself from siblings by naming get_backlinks for the reverse question and query_records for event 'type', so an agent can route without opening either 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?

Explicitly says when to use it ('Use this instead of fetching a collection and filtering it yourself') and why (whole-collection pulls are slow, the filter runs in the database). It names alternatives (get_backlinks, query_records) and gives concrete audit questions the tool answers, leaving little to inference.

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