Skip to main content
Glama

Analytics Legends — SAP AI & Analytics MCP Server

Count the firm directory by country, region, kind, module or SAP signal

count_firms_by
Read-onlyIdempotent

Answer a COUNTING question about the published firm directory in one call: how many organisations per country, per REGION (the six-value geography), per kind, per declared SAP module, or per SAP signal band — with the same country/kind/module/query filters search_firms takes, so you can count a slice as easily as the whole. Use this instead of paging search_firms and tallying rows: the directory holds thousands of organisations, and reading them all to produce a table of counts costs hundreds of calls and megabytes of rows for numbers Postgres computes in one scan. Every bucket is a value the directory actually stores; value: null is a real bucket meaning the field is unknown for those rows, and it is served rather than hidden — a country table that silently drops the rows with no country adds up to less than the population and says nothing about it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byYesWhich facet to count on. Required — there is no default worth guessing.
kindNoRestrict to one organisation kind before counting, same vocabulary as search_firms. Combining it with `by:"kind"` is legal and returns that single bucket.
queryNoFree-text filter, case-insensitive. EVERY word must appear in the record (substring per word, any order), so a natural-language phrase narrows the answer instead of having to match verbatim.
moduleNoRestrict to organisations with a DECLARED link to one SAP module code before counting, same vocabulary as search_firms' `module`. Combining it with `by:"module"` is legal and returns that single bucket (plus the null bucket).
regionNoRegion code of the HQ country — the platform's six-value geography: EMEA (Europe AND the Middle East), AMER (North America), LATAM, APAC, AFRICA (its own region, not folded into EMEA), GLOBAL (country unknown). Case-insensitive on input; anything else is refused.
countryNoISO-3166-1 alpha-2 country code, e.g. DE, FR, CH.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowsYes
toolYes
_metaNo
_attributionYes
result_countYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / by / enum
      Previous value: -[
      -  "country",
      -  "kind",
      -  "module",
      -  "sap_signal_band"
      -]New value: +[
      +  "country",
      +  "region",
      +  "kind",
      +  "module",
      +  "sap_signal_band"
      +]
    • addedInput schema / properties / region
      Added value: +{
      +  "description": "Region code of the HQ country — the platform's six-value geography: EMEA (Europe AND the Middle East), AMER (North America), LATAM, APAC, AFRICA (its own region, not folded into EMEA), GLOBAL (country unknown). Case-insensitive on input; anything else is refused.",
      +  "enum": [
      +    "EMEA",
      +    "AMER",
      +    "LATAM",
      +    "APAC",
      +    "AFRICA",
      +    "GLOBAL"
      +  ],
      +  "type": "string"
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / query / description
      Previous value: -"Free-text filter, matched case-insensitively."New value: +"Free-text filter, case-insensitive. EVERY word must appear in the record (substring per word, any order), so a natural-language phrase narrows the answer instead of having to match verbatim."
  3. Changed1 schema field changed
    • changedInput schema / properties / by / enum
      Previous value: -[
      -  "country",
      -  "kind",
      -  "sap_signal_band"
      -]New value: +[
      +  "country",
      +  "kind",
      +  "module",
      +  "sap_signal_band"
      +]
  4. Changed1 schema field changed
    • addedInput schema / properties / module
      Added value: +{
      +  "description": "Restrict to organisations with a DECLARED link to one SAP module code before counting, same vocabulary as search_firms' `module`. Combining it with `by:\"module\"` is legal and returns that single bucket (plus the null bucket).",
      +  "type": "string"
      +}
  5. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already cover readOnly/idempotent/non-destructive, but the description adds real behavior the agent could not infer: `value: null` is a served bucket meaning the field is unknown, and dropping it would silently under-count the population. This is exactly the kind of non-obvious trait worth disclosing.

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?

Purpose and the search_firms contrast are front-loaded, and the null-bucket caveat is a worthwhile final sentence. The prose is dense with em-dashes and long clauses, so it is slightly heavier than needed, but no sentence is filler.

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 six-parameter aggregation tool with full schema coverage, an output schema, and safety annotations, the description supplies the remaining decision-relevant context (when to use it, how nulls are handled). Nothing needed to call it correctly is missing.

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 legitimate meaning: filters reuse search_firms' vocabulary, `by` has no safe default, and the null bucket semantics affect how filter results should be read. It does not restate the enum values.

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 ('Answer a COUNTING question') and resource ('the published firm directory') and enumerates the five facets counted. It explicitly distinguishes itself from search_firms, so an agent can route without opening either 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 names the alternative ('Use this instead of paging `search_firms` and tallying rows') and gives the condition that selects this tool (directory holds thousands of orgs; reading all rows costs hundreds of calls). Also notes the filters mirror search_firms' vocabulary.

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.