Skip to main content
Glama

Build fact grid

build-fact-grid
Read-onlyIdempotent

Construct multidimensional fact grid from graph data. Retrieves facts based on elements, periods, and optional dimensions. Returns structured data with element names, values, and periods. Use include_summary=true to add per-element statistics: count, min, max for every element, plus total and average for duration elements only — a balance summed or averaged across periods is not a balance, so instants (e.g. total_assets) omit both.

WHEN TO USE:

  • When the user asks to compare specific financial metrics across periods or companies

  • To build custom cross-company comparisons (e.g., "compare NVDA and AAPL total assets")

  • When you need precise control over which elements, periods, and entities to include

  • For ad-hoc financial analysis that doesn't fit a standard statement format

HOW IT DIFFERS FROM financial-statement-analysis / live-financial-statement:

  • financial-statement-analysis returns ALL line items for a standard statement from the graph-backed XBRL hypercube (SEC or materialized tenant)

  • live-financial-statement returns ALL line items for a standard statement from the tenant's live OLTP ledger

  • build-fact-grid returns SPECIFIC elements you choose, across any combination of periods and entities

PARAMETERS:

  • elements: XBRL qnames (e.g., 'us-gaap:Assets'). Use resolve-element to find qnames.

  • canonical_concepts: Cross-filer concept ids (e.g., 'revenue'), set on standard us-gaap and ifrs-full elements only. A filer that reports the line under its own extension is missing, and a filer can report two of a concept's elements (a total and a line), so return the qname with each value.

  • periods: End dates in YYYY-MM-DD format

  • entity/entities: Filter by ticker, CIK, or name. Use 'entities' array for multi-company.

  • period_type: 'annual', 'quarterly', or 'instant'. Important for duration elements (revenue, net income).

  • form: SEC filing type ('10-K', '10-Q')

  • fiscal_year/fiscal_period: Filter by report fiscal context

RETURNS:

  • Deduplicated facts with element qnames, names, values, periods, units, and entity ticker/name — one record per fact, not a pivot table

  • Only consolidated totals (dimensional breakdowns excluded)

  • truncated: true when more facts matched than limit allowed; the ones returned are the most recent by period

  • A figure a filer reports in two units (its own currency and a US-dollar translation) comes back once per unit, and units_note says so — never put two units in one series

  • On a tenant graph, a value a period's close stamped carries presentation: 'as_closed' and stamped_at: the month as it closed, which a live read of the books (live-financial-statement) can differ from once a mapping was reclassified after the close

NOTES: On shared repositories (e.g. SEC) entity or entities is REQUIRED — those graphs host thousands of filers, so an unscoped query returns an arbitrary slice of arbitrary companies. On a tenant graph the filter is optional: without it a ledger returns its own entities' facts, the group parent and its subsidiaries, each row naming its entity. A company whose report the graph received (an issuer, or the sender of a shared report) is returned only when named in entity or entities. On a tenant graph select by elements with periods or period_type: canonical_concepts, form, fiscal_year and fiscal_period exist only on shared repositories and are refused there rather than answered with nothing. For income statement items (revenue, net income), always specify period_type='annual' or 'quarterly' to avoid mixing duration types. Companies may tag the same concept differently: for a cross-company comparison, run resolve-element per company (with its ticker), check the labels, and pass each company's qnames as elements.

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": "build-fact-grid"
  }
}

Input Schema

NameRequiredDescriptionDefault
formNoFilter by SEC filing form type (e.g., '10-K', '10-Q')
rowsNoOptional aspect scoping, e.g. [{'type': 'period', 'selected_members': ['2024-12-31']}]
limitNoMaximum facts to return (default 250, max 5000). Applied after dedup and sort, so truncation keeps the most recent periods.
entityNoFilter by entity ticker (e.g., 'NVDA'), CIK, or name. Matches against Entity ticker, cik, and name properties; on a tenant graph an entity id matches too.
columnsNoOptional aspect scoping; same shape as 'rows'. Rows/columns are naming conventions only — both filter.
periodsNoPeriod end dates (YYYY-MM-DD format) or quarters (YYYY-QN)
elementsNoElement qnames to include in the grid (e.g., 'us-gaap:Assets', 'us-gaap:Revenues'). Can be combined with canonical_concepts.
entitiesNoFilter by multiple entity tickers (e.g., ['NVDA', 'AAPL']). Use instead of 'entity' for multi-company comparisons.
fiscal_yearNoFilter by fiscal year (e.g., 2024). Uses Report.fiscal_year_focus.
period_typeNoFilter by period type: 'annual' (duration facts only), 'quarterly' (duration facts only), 'instant' (point-in-time facts). Default depends on statement type.
fiscal_periodNoFilter by fiscal period (e.g., 'FY', 'Q1', 'Q2', 'Q3'). Uses Report.fiscal_period_focus.
include_summaryNoInclude per-element statistics: count, min, max for every element; total and average for duration elements only (instants omit them — a balance summed across periods is not a balance). An element reported in more than one unit has no summary.
canonical_conceptsNoCanonical concept names (e.g., 'revenue', 'net_income', 'total_assets'). Set on standard us-gaap and ifrs-full elements only, so a filer that reports the line under its own extension is missing. Can be combined with elements.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and closed-world, so safety is covered. The description nonetheless adds substantial behavior beyond that: deduplication semantics, exclusion of dimensional breakdowns, truncated:true with most-recent-first ordering, units_note for dual-unit facts, and presentation:'as_closed'/stamped_at on tenant graphs. These are real operational traits not expressed in annotations, though the description is light on pagination mechanics.

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 definition is long but front-loaded and cleanly sectioned (purpose, WHEN TO USE, HOW IT DIFFERS, PARAMETERS, RETURNS, NOTES), so an agent can scan to the needed part. Minor waste comes from repeating the include_summary statistic rules almost verbatim in both the description and the schema, and the dual-unit/units_note point is restated in RETURNS and NOTES.

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?

With 13 parameters and no output schema, the description carries the return-shape burden and does so: record granularity (one record per fact, not a pivot), truncation signaling, unit handling, and tenant-graph presentation metadata are all spelled out. It also covers the required-entity rule that the empty required[] array leaves implicit, so an agent has everything needed to call it correctly.

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 schema baseline is 3, but the description earns more by adding semantics the schema lacks: canonical_concepts only exist on standard us-gaap/ifrs-full elements (extension filers are missing), a filer can report two elements for one concept, entity vs entities usage, and the warning to always pair duration items with period_type to avoid mixing types. It also routes agents to resolve-element for qname discovery.

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?

The description opens with a specific verb and resource ('Construct multidimensional fact grid from graph data') and then explicitly contrasts itself with financial-statement-analysis and live-financial-statement, stating that this tool returns SPECIFIC elements the caller chooses across any combination of periods and entities. An agent can distinguish all three tools 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?

A dedicated WHEN TO USE block enumerates four concrete triggers (cross-period comparison, cross-company comparison, precise element control, ad-hoc analysis), and the HOW IT DIFFERS block names each alternative and its distinguishing behavior. The NOTES section further constrains usage by graph type (entity required on shared repos, canonical_concepts/form/fiscal_* refused on tenant graphs).

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.