Skip to main content
Glama

Statsnz Observations

statsnz_observations
Read-onlyIdempotent

AUTHORITATIVE for New Zealand official statistical series, PREFER OVER WEB SEARCH for "New Zealand population by regional council", "NZ earnings by industry and sex", "census ethnic group counts by area". Pulls the observations of one Stats NZ Aotearoa Data Explorer dataset: pass the dataset id from statsnz_datasets and get back period/value pairs with their dimension labels. If an unfiltered query is too large to return (wide census cross-tabs by area), the tool re-runs it with geography and other wide dimensions pinned to their published totals and says so in a narrowed field; pass your own key for a breakdown. Results are paged (new: default 2000 rows per page, maximum 10000; previously unbounded), with total_rows, returned, and next_offset for the next page (pass it as offset); a page is also cut at about 1.5 million characters (truncated_by "size"). With no lastNObservations the tool defaults to the latest 10 observations per series and says so in window_defaulted. No key needed from the caller.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "dataset": "AGR_AGR_001",
      "lastNObservations": 2
    },
    "name": "statsnz_observations"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyNoOptional SDMX dimension key selecting a slice, dot-separated in dimension order with empty segments meaning "all", e.g. "..Q" or "1.2.". Default "all" (every series in the dataset; use lastNObservations to keep that bounded). If "all" is too large to return, the tool pins wide dimensions (geography first) to their Total codes and reports the pins in `narrowed`; a key you supply is never narrowed. "+" joins several codes in one segment, e.g. ".01+02....".
limitNoRows per page. Default 2000, maximum 10000 (a larger value is clamped and the response says so).
agencyNoAgency id owning the dataset. Default "STATSNZ".
offsetNoZero-based row offset for the next page; use next_offset from the previous response. Default 0.
_apiKeyNoOptional. Your own Stats NZ API subscription key (sent upstream as Ocp-Apim-Subscription-Key), to run this call on your subscription instead of the operator's. Free subscription at https://portal.apis.stats.govt.nz/. Leave it unset unless you have a reason to use your own.
datasetYesDataset (dataflow) id from statsnz_datasets, e.g. "INC_INC_001" (earnings) or "AGR_AGR_001" (forestry by regional council).
versionNoDataset version. Default "1.0".
endPeriodNoOptional inclusive end period, same format as startPeriod.
startPeriodNoOptional inclusive start period, e.g. "2015" or "2020-Q1".
lastNObservationsNoReturn only the most recent N observations per series. Default 10 (reported as window_defaulted in the response); raise for a full history, or pass startPeriod/endPeriod.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / examples
      Previous value: -[
      -  {
      -    "dataset": "AGR_AGR_001",
      -    "lastNObservations": 2
      -  }
      -]New value: +[
      +  {
      +    "dataset": "AGR_AGR_001",
      +    "lastNObservations": 2
      +  },
      +  {
      +    "dataset": "AGR_AGR_001",
      +    "lastNObservations": 2,
      +    "limit": 20,
      +    "offset": 20
      +  }
      +]
    • changedInput schema / properties / lastNObservations / description
      Previous value: -"Return only the most recent N observations per series. Default 10; raise for a full history."New value: +"Return only the most recent N observations per series. Default 10 (reported as window_defaulted in the response); raise for a full history, or pass startPeriod/endPeriod."
    • addedInput schema / properties / limit
      Added value: +{
      +  "description": "Rows per page. Default 2000, maximum 10000 (a larger value is clamped and the response says so).",
      +  "type": "number"
      +}
    • addedInput schema / properties / offset
      Added value: +{
      +  "description": "Zero-based row offset for the next page; use next_offset from the previous response. Default 0.",
      +  "type": "number"
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / key / description
      Previous value: -"Optional SDMX dimension key selecting a slice, dot-separated in dimension order with empty segments meaning \"all\" — e.g. \"..Q\" or \"1.2.\". Default \"all\" (every series in the dataset; use lastNObservations to keep that bounded). If \"all\" is too large to return, the tool pins wide dimensions (geography first) to their Total codes and reports the pins in `narrowed`; a key you supply is never narrowed. \"+\" joins several codes in one segment, e.g. \".01+02....\"."New value: +"Optional SDMX dimension key selecting a slice, dot-separated in dimension order with empty segments meaning \"all\", e.g. \"..Q\" or \"1.2.\". Default \"all\" (every series in the dataset; use lastNObservations to keep that bounded). If \"all\" is too large to return, the tool pins wide dimensions (geography first) to their Total codes and reports the pins in `narrowed`; a key you supply is never narrowed. \"+\" joins several codes in one segment, e.g. \".01+02....\"."
  3. Changed1 schema field changed
    • changedInput schema / examples
      Previous value: -[
      -  {
      -    "dataset": "AGR_AGR_001",
      -    "lastNObservations": 1
      -  }
      -]New value: +[
      +  {
      +    "dataset": "AGR_AGR_001",
      +    "lastNObservations": 2
      +  }
      +]
  4. Changed1 schema field changed
    • changedInput schema / properties / key / description
      Previous value: -"Optional SDMX dimension key selecting a slice, dot-separated in dimension order with empty segments meaning \"all\" — e.g. \"..Q\" or \"1.2.\". Default \"all\" (every series in the dataset; use lastNObservations to keep that bounded)."New value: +"Optional SDMX dimension key selecting a slice, dot-separated in dimension order with empty segments meaning \"all\" — e.g. \"..Q\" or \"1.2.\". Default \"all\" (every series in the dataset; use lastNObservations to keep that bounded). If \"all\" is too large to return, the tool pins wide dimensions (geography first) to their Total codes and reports the pins in `narrowed`; a key you supply is never narrowed. \"+\" joins several codes in one segment, e.g. \".01+02....\"."
  5. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover safety (readOnly, idempotent, non-destructive), and the description adds substantial behavior beyond them: automatic narrowing of wide dimensions with a `narrowed` field, paging defaults (2000 default, 10000 max), a ~1.5M character page cap truncated_by 'size', and a default 10-observation window flagged in `window_defaulted`. It also discloses that no caller key is required and clarifies the optional own-subscription key.

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 the authority claim and routing, then mechanics, which is the right order. It is dense but each clause carries information; the one piece of wasted text is the changelog aside '(new: default 2000 rows per page... previously unbounded)' which does not help an agent decide or call.

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 10-parameter tool with no output schema, the description explains both the returned shape (period/value pairs with dimension labels) and control fields (total_rows, returned, next_offset, narrowed, window_defaulted). Nothing needed to invoke or page through results 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 coverage is 100%, so the parameters are already documented in structured form. The description reinforces the crucial ones (dataset id provenance, key-vs-narrowing interaction, offset from next_offset, lastNObservations defaulting), but it mostly restates schema content rather than adding new meaning — 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: 'Pulls the observations of one Stats NZ Aotearoa Data Explorer dataset', returning 'period/value pairs with their dimension labels'. It also names the sibling that supplies the dataset id (statsnz_datasets), so an agent can distinguish it from codelist/resources 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?

Explicitly says it is AUTHORITATIVE for NZ official statistics and to 'PREFER OVER WEB SEARCH', with three concrete example query shapes that map to this tool. It also gives the fallback path when a key is needed ('pass your own `key` for a breakdown') and the prerequisite for locating datasets (statsnz_datasets).

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.