Skip to main content
Glama

Brazil CNPJ company registry

count_companies

Count companies or establishments, optionally grouped by one or two fields. Filters (all optional, combined with AND): cnae (CNAE code or prefix, e.g. '4711' or '47', list ok; add include_secondary to also match secondary activities), cnae_secao (letter A-U), uf, municipio (name as in Receita, accents ignored), municipio_codigo, situacao (ativa, baixada, suspensa, inapta, nula), matriz_only, porte (micro = ME, pequeno = EPP, demais, nao_informado), natureza_juridica (code prefix like '2062' or text like 'sociedade limitada'), capital_min/capital_max (BRL), opened_from/opened_to (data_inicio_atividade, YYYY-MM or YYYY-MM-DD), closed_from/closed_to (data da baixa), mei, simples (true/false), name_contains (razao social or nome fantasia; 3-256 characters and uf required), cep, partner_name (a partner's name contains this text). group_by options: uf, municipio, cnae_principal, cnae_divisao, cnae_secao, natureza_juridica, porte, situacao, ano_abertura, mes_abertura, ano_baixa, mes_baixa, mei, simples, matriz_filial, motivo_situacao. unit='estabelecimentos' (default) counts every CNPJ incl. filiais; unit='empresas' counts companies (matriz only). metric='sum_capital' sums declared capital social (BRL, companies only). Examples: MEIs opened per month in a state, active agro companies per municipality, closures by year.

Input Schema

NameRequiredDescriptionDefault
ufNo
cepNo
meiNo
cnaeNo
unitNoestabelecimentos
limitNo
orderNocount_desc
porteNo
metricNocount
simplesNo
group_byNo
situacaoNo
closed_toNo
municipioNo
opened_toNo
cnae_secaoNo
capital_maxNo
capital_minNo
closed_fromNo
matriz_onlyNo
opened_fromNo
partner_nameNo
name_containsNo
municipio_codigoNo
include_secondaryNo
natureza_juridicaNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/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 behavioral burden and does substantial work: it defines unit semantics ('estabelecimentos' counts every CNPJ including filiais; 'empresas' is matriz only), the metric='sum_capital' behavior (BRL, companies only), and matching quirks like prefix CNAE matching, include_secondary, and accents being ignored. Gaps remain around pagination/limit behavior and auth or rate limits, which are not mentioned.

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 purpose and filter list are front-loaded and every clause carries information an agent needs given the 0% schema coverage. It is presented as one dense semicolon-delimited run-on rather than scannable grouped sections, which slightly hurts navigability across 26 parameters but wastes no words.

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?

An output schema exists, so return values need no explanation, and the description covers filters, the AND-combination rule, all group_by options, unit and metric semantics, and worked examples. For a 26-parameter, zero-required-parameter aggregation tool this is complete enough for correct invocation, with only pagination semantics left implicit via schema defaults.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate entirely for 26 parameters, and it largely does: it gives accepted values and formats for nearly every filter (cnae prefixes, 'letter A-U', situacao enums, porte labels, natureza_juridica prefixes, date formats YYYY-MM/YYYY-MM-DD, name_contains 3-256 char + uf requirement). Only limit, order, and cep lack semantic detail, which is a minor residue against an otherwise exhaustive list.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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: 'Count companies or establishments, optionally grouped by one or two fields.' That aggregation framing distinguishes it in practice from listing siblings like search_companies or get_company, but no sibling is named, so an agent must infer the boundary rather than being told.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is well-contextualized through the closing examples ('MEIs opened per month in a state, active agro companies per municipality, closures by year'), which map concrete analytical questions onto the tool. However, it never explicitly states when to use count_companies versus search_companies, and there are no exclusions or prerequisites.

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.