Skip to main content
Glama

Count facts

lore_aggregate_facts

Aggregate fact history deterministically: count facts grouped by subject, predicate, or object with date-range filters to answer how many or which values occur most often.

Instructions

Deterministic aggregation over fact history — counts grouped by object/subject/predicate with date-range filters. Use for "how many X", "which Y most often" questions; similarity search cannot answer these reliably. Returns { groups, totalGroups, limit }: groups is the top limit (default 100), so read totalGroups for "how many distinct values are there" rather than counting groups, and raise limit if you need the tail.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNomax groups returned (default 100); totalGroups always reports the real count
sinceNo
untilNo
groupByNo
subjectNo
predicateNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.38.0

TDQS

A4.4/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 burden and does well: it declares determinism, the return envelope {groups, totalGroups, limit}, and the critical interpretation rule that groups is truncated to limit while totalGroups is the true count. It omits cost/performance characteristics and any permission or auth notes, which keeps it short of a 5.

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

Conciseness5/5

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

Three sentences, each earning its place: purpose first, then the routing rule, then the return-value caveat. The totalGroups pitfall is front-loaded where an agent will read it before writing code.

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?

There is no output schema, so describing the return envelope and the groups-vs-totalGroups distinction is exactly the right compensation, and it is complete for calling the tool correctly. The residual gap is filter parameter syntax (especially date formats), which is not addressed anywhere.

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 only 17%, so the description must compensate, and it does so well for limit (default 100, raise it for the tail) and implies groupBy's role. However, since/until date format and the semantics of the subject/predicate filters remain undocumented in both schema and description, leaving several of the 6 parameters ambiguous.

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+resource ('deterministic aggregation over fact history') plus the exact grouping dimensions (object/subject/predicate) and date-range filtering. It also implicitly distinguishes itself from similarity-based siblings, so an agent can tell it apart from lore_search without opening a 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?

Gives concrete trigger questions ('how many X', 'which Y most often') and an explicit exclusion: similarity search cannot answer these reliably. This routes the agent between this tool and the search family with no inference required.

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