Skip to main content
Glama

retrieve_entities

Use this when you need filtered entity lists (by type, pagination, and optional published/date filters) or lexical/semantic retrieval via search. Strict mode: search cannot be combined with non-default sorting or published filters.

Instructions

Use this when you need filtered entity lists (by type, pagination, and optional published/date filters) or lexical/semantic retrieval via search. Strict mode: search cannot be combined with non-default sorting or published filters. Set include_snapshots=false for lightweight responses that omit snapshot/provenance/raw_fragments. Use snapshot_filters to filter by snapshot field values server-side (e.g. { "status": { "op": "eq", "value": "active" } } for active entities). Compatibility aliases search_query and query are accepted but search is canonical. For deep pagination under the default sort (sort_by=entity_id), pass the next_cursor from a prior response back as cursor instead of a large offset; offset beyond a bounded depth is rejected and cursor is not supported with search, non-default sort_by, or a non-zero offset in the same call. Opt in with read_mode: exact_identity and only one entity_type plus one snapshot_filters string equality on its declared identity field. Treat only the explicit exact_identity.state and common_view as proof.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "retrieve_entities"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of entities to return (default 100). Capped at 500 when `include_snapshots` is true (the default), since each snapshot is hydrated synchronously; lower the page size or set `include_snapshots=false` for larger pages.
queryNoCompatibility alias for `search`.
cursorNoOpaque keyset pagination cursor from a previous response's `next_cursor`. Returns the next page in O(page size) time regardless of position, unlike `offset` which is bounded and deprecated. Only supported with the default `sort_by=entity_id`; cannot be combined with `search` or a non-zero `offset`. Reusing a cursor after changing `sort_order` returns a structured error.
offsetNoDeprecated in favor of `cursor`. Still accepted for back-compat but internally bounded: values above 2000 are rejected with a structured hint pointing to `cursor`. Supplying a non-zero `offset` together with `cursor` is rejected as a validation error; use one or the other. (default 0).
searchNoCanonical free-text query for lexical/semantic retrieval. Cannot be combined with published filters or non-default sorting.
sort_byNoSort field. Non-default values cannot be combined with `search`. Predefined values: `entity_id`, `canonical_name`, `observation_count`, `last_observation_at`, `submitted_at` (orders by `snapshot.created_at`). In addition, `snapshot.<field>` is supported for any snapshot field (e.g. `snapshot.period_end` for time-series entity types such as `usage_digest`). The field value is sorted lexicographically as a string, so ISO-8601 date strings must use a consistent format so that lexicographic order matches temporal order.
user_idNoOptional explicit user ID (normally inferred from auth context).
publishedNoFilter by snapshot.published. Cannot be combined with `search`.
read_modeNoBounded same-view read with one entity_type and one snapshot_filters string equality. Supply no other options.
sort_orderNoSort direction. `desc` cannot be combined with `search`.
entity_typeNoOptional single entity type filter (for example: post, task, contact). Combined as a union with `entity_types` when both are supplied.
entity_typesNoOptional multi-type filter. When non-empty, results are restricted to entities whose type is in this list (IN filter), OR-combined with `entity_type`. An empty array is treated as no filter.
search_queryNoCompatibility alias for `search`.
created_sinceNoISO 8601 timestamp. Return only entities whose created_at is greater than or equal to this value.
updated_sinceNoISO 8601 timestamp. Return only entities whose updated_at is greater than or equal to this value.
include_mergedNoWhether to include merged entities (default false).
published_afterNoInclusive lower bound for snapshot.published_date (ISO date/datetime). Cannot be combined with `search`.
published_beforeNoInclusive upper bound for snapshot.published_date (ISO date/datetime). Cannot be combined with `search`.
snapshot_filtersNoFilter entities by snapshot field values. Each key is a snake_case snapshot field name (e.g. `status`, `priority`); the value specifies operator and comparison value. Filters are applied server-side via `snapshot->>{field}` JSONB extraction, so only entities whose snapshot contains a matching value are returned. Example: `{ "status": { "op": "eq", "value": "active" } }` returns only entities with `snapshot.status === "active"`. Supported ops: `eq`, `in`, `gt`, `lt`, `gte`, `lte`, `contains`, `contains_word`. `contains` is a raw case-insensitive SUBSTRING match — `{ "title": { "op": "contains", "value": "CTO" } }` also matches "director" and "doctor", and `"COO"` matches "coordinator". Prefer `contains_word` when you mean a whole word/token: it matches only when the value appears as a complete token delimited by punctuation or whitespace, so `"CTO"` matches "VP, CTO" and "CTO & Co-founder" but not "director"; `"Care"` does not match "Careers". Punctuation inside the term is handled: `"O'Brien"`, `"R&D"`, and `"100%"` match their stored values (separators in the term are normalized the same way as the stored value). Case-insensitivity for `contains_word` is ASCII-only.
include_snapshotsNoWhen false, omit snapshot/provenance/raw_fragments payloads for lightweight responses.
exclude_bookkeepingNoWhen true, omit chat bookkeeping types (`conversation`, `conversation_message`, etc.) from results. Default false. Has no effect when `entity_type` already filters to a bookkeeping type.
similarity_thresholdNoSemantic distance threshold when `search` is used. Lower is stricter (typical 1.0-1.05).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.29.1
    • addedInput schema / properties / read_mode
      Added value: +{
      +  "description": "Bounded same-view read with one entity_type and one snapshot_filters string equality. Supply no other options.",
      +  "enum": [
      +    "exact_identity"
      +  ],
      +  "type": "string"
      +}
  2. Changed6 schema fields changedv0.21.0
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "Opaque keyset pagination cursor from a previous response's `next_cursor`. Returns the next page in O(page size) time regardless of position, unlike `offset` which is bounded and deprecated. Only supported with the default `sort_by=entity_id`; cannot be combined with `search` or a non-zero `offset`. Reusing a cursor after changing `sort_order` returns a structured error.",
      +  "type": "string"
      +}
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum number of entities to return (default 100)."New value: +"Maximum number of entities to return (default 100). Capped at 500 when `include_snapshots` is true (the default), since each snapshot is hydrated synchronously; lower the page size or set `include_snapshots=false` for larger pages."
    • addedInput schema / properties / offset / deprecated
      Added value: +true
    • changedInput schema / properties / offset / description
      Previous value: -"Pagination offset (default 0)."New value: +"Deprecated in favor of `cursor`. Still accepted for back-compat but internally bounded: values above 2000 are rejected with a structured hint pointing to `cursor`. Supplying a non-zero `offset` together with `cursor` is rejected as a validation error; use one or the other. (default 0)."
    • changedInput schema / properties / snapshot_filters / additionalProperties / properties / op / enum
      Previous value: -[
      -  "eq",
      -  "in",
      -  "gt",
      -  "lt",
      -  "gte",
      -  "lte",
      -  "contains"
      -]New value: +[
      +  "eq",
      +  "in",
      +  "gt",
      +  "lt",
      +  "gte",
      +  "lte",
      +  "contains",
      +  "contains_word"
      +]
    • changedInput schema / properties / snapshot_filters / description
      Previous value: -"Filter entities by snapshot field values. Each key is a snake_case snapshot field name (e.g. `status`, `priority`); the value specifies operator and comparison value. Filters are applied server-side via `snapshot->>{field}` JSONB extraction, so only entities whose snapshot contains a matching value are returned. Example: `{ \"status\": { \"op\": \"eq\", \"value\": \"active\" } }` returns only entities with `snapshot.status === \"active\"`. Supported ops: `eq`, `in`, `gt`, `lt`, `gte`, `lte`, `contains`."New value: +"Filter entities by snapshot field values. Each key is a snake_case snapshot field name (e.g. `status`, `priority`); the value specifies operator and comparison value. Filters are applied server-side via `snapshot->>{field}` JSONB extraction, so only entities whose snapshot contains a matching value are returned. Example: `{ \"status\": { \"op\": \"eq\", \"value\": \"active\" } }` returns only entities with `snapshot.status === \"active\"`. Supported ops: `eq`, `in`, `gt`, `lt`, `gte`, `lte`, `contains`, `contains_word`. `contains` is a raw case-insensitive SUBSTRING match — `{ \"title\": { \"op\": \"contains\", \"value\": \"CTO\" } }` also matches \"director\" and \"doctor\", and `\"COO\"` matches \"coordinator\". Prefer `contains_word` when you mean a whole word/token: it matches only when the value appears as a complete token delimited by punctuation or whitespace, so `\"CTO\"` matches \"VP, CTO\" and \"CTO & Co-founder\" but not \"director\"; `\"Care\"` does not match \"Careers\". Punctuation inside the term is handled: `\"O'Brien\"`, `\"R&D\"`, and `\"100%\"` match their stored values (separators in the term are normalized the same way as the stored value). Case-insensitivity for `contains_word` is ASCII-only."
  3. Changed5 schema fields changedv0.16.0
    • changedInput schema / properties / entity_type / description
      Previous value: -"Optional entity type filter (for example: post, task, contact)."New value: +"Optional single entity type filter (for example: post, task, contact). Combined as a union with `entity_types` when both are supplied."
    • addedInput schema / properties / entity_types
      Added value: +{
      +  "description": "Optional multi-type filter. When non-empty, results are restricted to entities whose type is in this list (IN filter), OR-combined with `entity_type`. An empty array is treated as no filter.",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedInput schema / properties / snapshot_filters
      Added value: +{
      +  "additionalProperties": {
      +    "properties": {
      +      "op": {
      +        "enum": [
      +          "eq",
      +          "in",
      +          "gt",
      +          "lt",
      +          "gte",
      +          "lte",
      +          "contains"
      +        ],
      +        "type": "string"
      +      },
      +      "value": {}
      +    },
      +    "required": [
      +      "op"
      +    ],
      +    "type": "object"
      +  },
      +  "description": "Filter entities by snapshot field values. Each key is a snake_case snapshot field name (e.g. `status`, `priority`); the value specifies operator and comparison value. Filters are applied server-side via `snapshot->>{field}` JSONB extraction, so only entities whose snapshot contains a matching value are returned. Example: `{ \"status\": { \"op\": \"eq\", \"value\": \"active\" } }` returns only entities with `snapshot.status === \"active\"`. Supported ops: `eq`, `in`, `gt`, `lt`, `gte`, `lte`, `contains`.",
      +  "type": "object"
      +}
    • changedInput schema / properties / sort_by / description
      Previous value: -"Sort field. Non-default values cannot be combined with `search`."New value: +"Sort field. Non-default values cannot be combined with `search`. Predefined values: `entity_id`, `canonical_name`, `observation_count`, `last_observation_at`, `submitted_at` (orders by `snapshot.created_at`). In addition, `snapshot.<field>` is supported for any snapshot field (e.g. `snapshot.period_end` for time-series entity types such as `usage_digest`). The field value is sorted lexicographically as a string, so ISO-8601 date strings must use a consistent format so that lexicographic order matches temporal order."
    • removedInput schema / properties / sort_by / enum
      Removed value: -[
      -  "entity_id",
      -  "canonical_name",
      -  "observation_count",
      -  "last_observation_at"
      -]
  4. Addedv0.15.0
  5. Removedv0.14.0
  6. Addedv0.12.1
  7. Removedv0.11.0
  8. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and discloses important traits: strict-mode constraints, lightweight responses via `include_snapshots=false`, server-side `snapshot_filters`, cursor versus offset behavior, and exact_identity proof limits. It does not cover auth requirements, rate limits, or response shape, but it is substantially more transparent than typical unannotated definitions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the primary use case, and most clauses carry useful constraints. However, it is a dense single paragraph with many semicolon-separated rules, making it harder to scan than a structured list would be.

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?

For a 22-parameter tool with no output schema and no annotations, the description is fairly complete: it covers filtering, search, pagination, response weight, and exact_identity behavior. It leaves some parameters to the schema and does not describe return values, but the schema is rich enough to support that division.

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 coverage is 100%, so the baseline is 3, but the description adds meaningful cross-parameter semantics beyond the schema: alias handling for `search_query`/`query`, cursor incompatibilities, exact_identity constraints, and the distinction between `contains` and `contains_word`. It does not explain every parameter, but it adds real value over the structured schema.

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 purpose: filtered entity lists by type, pagination, published/date filters, or lexical/semantic retrieval via `search`. It is clear what the tool does, but it does not explicitly differentiate itself from siblings such as `retrieve_entity_by_identifier` or `retrieve_related_entities`.

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 usage context, including when to use filtered lists versus `search`, and documents strict-mode incompatibilities such as `search` with non-default sorting or published filters. It also explains pagination guidance and exact_identity opt-in, though it does not name alternative tools for related retrieval needs.

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