Skip to main content
Glama

Statistics Canada MCP Server

get_code_sets

Read-only

Decode StatCan WDS numeric codes (e.g. frequencyCode 6 = Monthly, scalarFactorCode 0 = units). Corresponds to: GET /getCodeSets

Without arguments, returns a summary: small code sets (scalar, frequency, symbol, status, ...) in full, and only entry counts for large ones (uom, survey, subject, classificationType). Request a large set with code_set, and narrow it with search: get_code_sets(code_set="uom", search="percent")

Returns: Dict[str, Any]: {code_set_name: [entries]} for the returned sets, plus "_large_code_sets" {name: entry count} in the summary. Raises: ValueError: If code_set is unknown or the API response is not SUCCESS.

IMPORTANT: In your final response to the user, you MUST cite the source of your data. For code sets, this means specifying which code set table or definition is being used.

Input Schema

NameRequiredDescriptionDefault
searchNoCase-insensitive text or code to filter entries of code_set (e.g. 'percent', '17').
code_setNoOne code set to return in full: scalar, frequency, symbol, status, uom, survey, subject, classificationType, securityLevel, terminated, wdsResponseStatus. Omit for a summary (small sets in full, counts for large ones).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / code_set
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "One code set to return in full: scalar, frequency, symbol, status, uom, survey, subject, classificationType, securityLevel, terminated, wdsResponseStatus. Omit for a summary (small sets in full, counts for large ones).",
      +  "title": "Code Set"
      +}
    • addedInput schema / properties / search
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Case-insensitive text or code to filter entries of code_set (e.g. 'percent', '17').",
      +  "title": "Search"
      +}
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint, but the description adds the default-behavior contract (small sets returned in full, counts only for large ones), the response shape including the `_large_code_sets` key, and the ValueError condition. This goes well beyond what annotations provide and is the exact information an agent needs to avoid a 'missing data' misread.

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-loads the purpose, then behavior, return shape, and errors in short labeled blocks, with the example call placed inline. The trailing 'IMPORTANT: cite the source' block is a response-policy instruction rather than selection guidance, but it is a genuine output obligation and only costs a small amount of length.

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 no output schema, the description carries the return-value burden itself and does so: it gives the dict shape, the special `_large_code_sets` key, and the failure mode. An agent can call this correctly and interpret the result without further inference.

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; the description adds value by showing the two optional params used together and explaining what omitting them yields. It doesn't add syntax nuance beyond the schema's own text (e.g. match semantics of `search` are already in the schema), keeping it at 4 rather than 5.

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 ('Decode StatCan WDS numeric codes') and grounds it with a concrete mapping example (frequencyCode 6 = Monthly), plus the underlying endpoint. No sibling tool in the list deals with WDS code sets, so the resource alone distinguishes it.

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 covers the three usage modes: no arguments for a summary, code_set to fetch a large set in full, and search to narrow within it, backed by a literal example call `get_code_sets(code_set="uom", search="percent")`. It also names which sets are large vs. small, so an agent knows why a set might be missing from the default response.

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.