Skip to main content
Glama

Classificação CNAE

ibge_cnae
Read-onlyIdempotent

Find Brazilian economic activity codes and descriptions by searching CNAE classifications. Query by code or keyword to get details for sections, divisions, groups, classes, and subclasses.

Instructions

Queries CNAE (National Classification of Economic Activities) from IBGE.

CNAE is the official classification for economic activities in Brazil.

Hierarchical structure:

  • Section (letter A-U): 21 main categories

  • Division (2 digits): 87 divisions

  • Group (3 digits): 285 groups

  • Class (4-5 digits): 673 classes

  • Subclass (7 digits): 1,332 subclasses

Features:

  • Search by CNAE code

  • Search by activity description

  • List by hierarchical level

  • Show complete hierarchy

Examples:

  • Search software: busca="software"

  • Specific code: codigo="6201-5/01"

  • View section: codigo="J"

  • List divisions: nivel="divisoes"

Behavior: read-only and idempotent — a live GET against the public IBGE CNAE API. Returns Markdown.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
buscaNoTermo para buscar na descrição das atividades (ex: 'software', 'restaurante', 'comércio'). Acento e caixa não importam, e várias palavras casam em E ('comercio varejista'). A palavra de todo dia é traduzida para a da CNAE quando preciso — farmácia → produtos farmacêuticos, academia → condicionamento físico, lixo → resíduos — e a resposta diz quando traduziu.
nivelNoNível hierárquico para listar (padrão: mostra todos os níveis relevantes)
codigoNoCódigo CNAE para buscar (seção, divisão, grupo, classe ou subclasse). Exemplos: - Seção: "A" (agricultura) - Divisão: "01" (agricultura e pecuária) - Grupo: "01.1" (produção de lavouras) - Classe: "01.11" (cultivo de cereais) - Subclasse: "0111-3/01" (cultivo de arroz)
limiteNoNúmero máximo de resultados (padrão: 20)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modoYesModo de resposta que gerou os dados
buscaNoPresente no modo de busca por termo
listaNoPresente no modo de listagem por nível
codigoNoPresente no modo de consulta por código
provenanceYesBloco de proveniência (contrato v1.0): fonte, URL, período, extração e licença
attributionYesURLs canônicas das fontes desta resposta (lista de atribuição)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv5.2.0
    • changedInput schema / properties / busca / description
      Previous value: -"Termo para buscar na descrição das atividades (ex: 'software', 'restaurante', 'comércio')"New value: +"Termo para buscar na descrição das atividades (ex: 'software', 'restaurante', 'comércio').\nAcento e caixa não importam, e várias palavras casam em E ('comercio varejista').\nA palavra de todo dia é traduzida para a da CNAE quando preciso — farmácia →\nprodutos farmacêuticos, academia → condicionamento físico, lixo → resíduos — e a\nresposta diz quando traduziu."
    • addedOutput schema / properties / busca / properties / encontrados
      Added value: +{
      +  "description": "Quantidade de atividades que casam o termo no catálogo inteiro (pode ser maior que 'total', que é limitado por 'limite')",
      +  "type": "number"
      +}
    • addedOutput schema / properties / busca / properties / notas_vocabulario
      Added value: +{
      +  "description": "Presente quando o termo foi traduzido para a palavra que a CNAE usa (ex: farmácia → produtos farmacêuticos)",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / properties / busca / required
      Previous value: -[
      -  "termo",
      -  "nivel",
      -  "total",
      -  "resultados"
      -]New value: +[
      +  "termo",
      +  "nivel",
      +  "total",
      +  "encontrados",
      +  "resultados"
      +]
  2. Changed1 schema field changedv5.0.0
    • addedInput schema / additionalProperties
      Added value: +false
  3. Changed4 schema fields changedv4.0.0
    • removedOutput schema / properties / provenance / properties / data_vintage / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / provenance / properties / data_vintage / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / provenance / properties / license / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / provenance / properties / license / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  4. Changed6 schema fields changedv3.3.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / properties / attribution
      Added value: +{
      +  "description": "URLs canônicas das fontes desta resposta (lista de atribuição)",
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / provenance
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Bloco de proveniência (contrato v1.0): fonte, URL, período, extração e licença",
      +  "properties": {
      +    "citation": {
      +      "description": "Citação pronta para uso",
      +      "type": "string"
      +    },
      +    "data_vintage": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Período de referência do dado segundo a fonte; null se a fonte não expõe"
      +    },
      +    "license": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Regime legal do dado"
      +    },
      +    "retrieved_at": {
      +      "description": "Instante real da extração no upstream (ISO-8601, horário de Brasília)",
      +      "type": "string"
      +    },
      +    "source": {
      +      "description": "Fonte oficial do dado (API do IBGE consultada)",
      +      "type": "string"
      +    },
      +    "source_url": {
      +      "description": "URL canônica que reproduz a consulta",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "source",
      +    "source_url",
      +    "data_vintage",
      +    "retrieved_at",
      +    "citation",
      +    "license"
      +  ],
      +  "type": "object"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "modo"
      -]New value: +[
      +  "modo",
      +  "provenance",
      +  "attribution"
      +]
  5. Changed1 schema field changedv3.0.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "busca": {
      +      "additionalProperties": false,
      +      "description": "Presente no modo de busca por termo",
      +      "properties": {
      +        "nivel": {
      +          "description": "Nível hierárquico pesquisado (ex: subclasses, classes)",
      +          "type": "string"
      +        },
      +        "resultados": {
      +          "description": "Atividades encontradas para o termo",
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "descricao": {
      +                "description": "Descrição da atividade",
      +                "type": "string"
      +              },
      +              "id": {
      +                "description": "Código CNAE da atividade",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "descricao"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "termo": {
      +          "description": "Termo pesquisado",
      +          "type": "string"
      +        },
      +        "total": {
      +          "description": "Quantidade de resultados retornados",
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "termo",
      +        "nivel",
      +        "total",
      +        "resultados"
      +      ],
      +      "type": "object"
      +    },
      +    "codigo": {
      +      "additionalProperties": false,
      +      "description": "Presente no modo de consulta por código",
      +      "properties": {
      +        "descricao": {
      +          "description": "Descrição do código",
      +          "type": "string"
      +        },
      +        "hierarquia": {
      +          "description": "Cadeia hierárquica do código (do mais geral ao mais específico)",
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "descricao": {
      +                "description": "Descrição do nível",
      +                "type": "string"
      +              },
      +              "id": {
      +                "description": "Código do nível",
      +                "type": "string"
      +              },
      +              "nivel": {
      +                "description": "Nível hierárquico (Seção, Divisão, Grupo, Classe, Subclasse)",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "nivel",
      +              "id",
      +              "descricao"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "id": {
      +          "description": "Código CNAE consultado",
      +          "type": "string"
      +        },
      +        "nivel": {
      +          "description": "Nível do código (secao, divisao, grupo, classe ou subclasse)",
      +          "type": "string"
      +        },
      +        "observacoes": {
      +          "description": "Observações/notas explicativas do código",
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "descricao",
      +        "nivel"
      +      ],
      +      "type": "object"
      +    },
      +    "lista": {
      +      "additionalProperties": false,
      +      "description": "Presente no modo de listagem por nível",
      +      "properties": {
      +        "exibidos": {
      +          "description": "Quantidade de registros exibidos (limitada por 'limite')",
      +          "type": "number"
      +        },
      +        "nivel": {
      +          "description": "Nível hierárquico listado",
      +          "type": "string"
      +        },
      +        "registros": {
      +          "description": "Registros do nível listado",
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "descricao": {
      +                "description": "Descrição do registro",
      +                "type": "string"
      +              },
      +              "id": {
      +                "description": "Código CNAE do registro",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "id",
      +              "descricao"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "total": {
      +          "description": "Total de registros existentes no nível",
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "nivel",
      +        "total",
      +        "exibidos",
      +        "registros"
      +      ],
      +      "type": "object"
      +    },
      +    "modo": {
      +      "description": "Modo de resposta que gerou os dados",
      +      "enum": [
      +        "busca",
      +        "codigo",
      +        "lista",
      +        "estrutura"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "modo"
      +  ],
      +  "type": "object"
      +}
  6. First observedv1.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false. The description adds useful behavioral context beyond those annotations by stating it is a 'live GET against the public IBGE CNAE API' and that it 'Returns Markdown'. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and front-loaded: purpose, hierarchy context, features, examples, and behavior. Every section is compact and earns its place, with no wasted 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?

Given the tool's optional parameters, rich schema documentation, safety annotations, and output schema, the description is complete. It covers the domain hierarchy, available query modes, example invocations, and the API/return format. Nothing critical is missing for an agent to invoke the tool successfully.

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%, and the schema already documents every parameter in detail, including search semantics and code examples. The description's examples are convenient and reinforce usage patterns, but they add little meaning beyond the schema's own parameter descriptions.

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 first sentence states a specific verb and resource: 'Queries CNAE ... from IBGE.' The description further clarifies the object with the official hierarchical levels and feature bullets, making its purpose unambiguous among the many ibge_* sibling tools.

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?

The description gives clear usage context through features and concrete examples ('busca="software"', 'codigo="6201-5/01"', 'nivel="divisoes"'). It does not explicitly contrast itself against alternatives, but the examples and hierarchical structure strongly imply when to use this tool.

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