Skip to main content
Glama

Consulta de tabelas SIDRA

ibge_sidra
Read-onlyIdempotent

Query SIDRA tables to retrieve IBGE statistics like Census population, PNAD unemployment and GDP for Brazil, states or municipalities, with optional ranking and distribution stats.

Instructions

Queries SIDRA tables (IBGE's Automatic Recovery System).

SIDRA contains data from IBGE surveys like Census, PNAD, GDP, etc.

Common tables:

  • 6579: Population estimates (annual)

  • 9514: Census 2022 population

  • 200: Census population (1970-2010)

  • 4714: Population, territorial area and density (Census 2022)

  • 4099: Unemployment rate (PNAD Contínua, quarterly)

  • 5436: Average real income (PNAD Contínua, quarterly)

  • 1846: Quarterly GDP at current prices (Brazil)

  • 5938: Municipal GDP at current prices (annual, down to municipality)

  • 6784: Annual GDP and GDP per capita (Brazil)

Territorial levels:

  • 1: Brazil

  • 2: Region (North, Northeast, etc.)

  • 3: State (UF)

  • 6: Municipality

  • 7: Metropolitan Region

Examples:

  • Brazil population 2023: tabela="6579", periodos="2023"

  • Population by state: tabela="6579", nivel_territorial="3"

  • Census 2022 by municipality: tabela="9514", nivel_territorial="6", localidades="3550308"

What each number is: every record carries the SIDRA period column (code and label, e.g. "Mês (Código)" 202403 / "Mês" "março 2024") and the "Variável" label — the only place that says whether a value is a monthly change, a year-to-date or 12-month accumulation, an index number or a level; read it before adding, subtracting or comparing values. A PNAD rolling quarter ("jun-jul-ago 2026") is a three-month window that moves every month, not a calendar quarter. Revisions: values are what SIDRA publishes at the extraction instant (retrieved_at); IBGE revises published figures (quarterly GDP at each release, PNAD reweighting, annual revisions of PIM/PMC/PMS) and the API keeps no earlier version.

Statistics mode: for largest/smallest/mean/median/distribution/ranking questions ("which municipality has the largest population?", "median GDP by state") use estatisticas=true — it computes min/max/mean/median/std-dev/labeled percentiles over ALL data rows BEFORE pagination and returns top/bottom rankings (default 10, cap 100 via topN), so one call answers what would otherwise require paging thousands of records. With agruparPor="" (e.g. "Unidade da Federação", "Ano") it ranks groups by descending sum, each with its own mini-distribution. Queries mixing several variables auto-group by "Variável" (units differ). SIDRA absence markers ("-", "..", "...", "X") are excluded from n. In this mode pagina/campos/formato are ignored and registros comes empty. Very large queries are refused by the source (since 2026-09-16 SIDRA tables are read through the Aggregates API, whose ceiling is lower than SIDRA's old 100,000-value cap: all municipalities × 12 yearly periods fails, × 8 works) — narrow periodos (e.g. "last 4") or raise nivel_territorial.

ibge_sidra is the low-level engine. Prefer a friendlier wrapper when it fits:

  • Census themes (1970–2022) → ibge_censo

  • Economic/social time series → ibge_indicadores

  • Rank/compare 2–10 localities → ibge_comparar

  • One municipality's panel → ibge_cidades Use ibge_sidra_tabelas and ibge_sidra_metadados to find a table code and its structure before querying.

Behavior: read-only and idempotent — a live GET against the public IBGE SIDRA API. Returns Markdown plus a typed structuredContent payload.

Input Schema

NameRequiredDescriptionDefault
topNNoTamanho das listas top/bottom quando estatisticas=true sem agruparPor (padrão: 10, máx: 100)
camposNoSelecionar apenas algumas colunas por rótulo, separadas por vírgula (ex: 'Valor,Ano'). Reduz o volume da resposta. Omitir traz todas.
paginaNoPágina de resultados (100 registros por página)
tabelaYesCódigo da tabela SIDRA (ex: 6579 para estimativas de população, 9514 para censo 2022)
formatoNoFormato de saída: 'json' para dados brutos ou 'tabela' para formato legíveltabela
periodosNoPeríodos: 'last' para último, 'all' para todos, ou anos específicos (ex: 2020,2021,2022)last
variaveisNoIDs das variáveis separados por vírgula, ou 'allxp' para todasallxp
agruparPorNoCom estatisticas=true, agrupa pela coluna informada (rótulo, ex: 'Unidade da Federação', 'Ano') e ranqueia os grupos por soma decrescente (grupos[0] = maior total), cada grupo com sua mini-distribuição. Nome curto ('UF', 'estado', 'cidade', 'região') e rótulo parcial ('Federação') são resolvidos, e a resposta diz em `aviso` por qual coluna agrupou; rótulo que casa com duas colunas é recusado em vez de escolhido
localidadesNoCódigos das localidades separados por vírgula, ou 'all' para todasall
estatisticasNoComputa estatísticas (mínimo/máximo/média/mediana/desvio-padrão/percentis) sobre TODOS os registros da consulta, antes da paginação, + ranking top/bottom. Use para 'qual o maior/menor', 'média', 'mediana', 'distribuição', 'ranking'. Quando true, ignora pagina, campos e formato
classificacoesNoClassificações no formato 'id[categorias]' (ex: '2[6794]' para sexo masculino)
nivel_territorialNoNível territorial (código N): 1=Brasil, 2=Região, 3=UF, 6=Município, 7=Região Metropolitana, 8=Mesorregião, 9=Microrregião, 10=Distrito, 11=Subdistrito, 13=RM/RIDE, 14=RIDE, 15=Aglomeração Urbana, 17=Região Geográfica Imediata, 18=Região Geográfica Intermediária, 105=Macrorregião de Saúde, 106=Região de Saúde, 114=Aglomerado Subnormal, 127=Amazônia Legal, 128=Semiárido1

Output Schema

NameRequiredDescriptionDefault
nomeYesNome da tabela (quando conhecido)
tabelaYesCódigo da tabela SIDRA consultada
colunasYesRótulos das colunas, na ordem
unidadesYesUnidade de medida de cada variável da resposta, FORA de `registros`: não some com `campos` nem com a paginação. Leia antes de citar um valor — 'Mil pessoas' significa que 1.234 são 1,234 milhão de pessoas
paginacaoYesMetadados de paginação para continuação
registrosYesRegistros da página atual: cada um mapeia rótulo da coluna -> valor
provenanceYesBloco de proveniência do portfólio: fonte, URL, período, extração, diagnóstico de origem e licença
attributionYesURLs canônicas das fontes desta resposta (lista de atribuição)
estatisticasNoBloco estatístico presente quando estatisticas=true (registros vem vazio nesse modo)
totalRegistrosYesTotal de registros de dados disponíveis (todas as páginas)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed18 schema fields changedv5.11.0
    • addedOutput schema / properties / estatisticas / properties / distribuicao / properties / desvioPadrao / description
      Added value: +"Desvio-padrão populacional (divide por n: os dados são censitários, não amostra)"
    • addedOutput schema / properties / estatisticas / properties / distribuicao / properties / maximo / description
      Added value: +"Maior valor"
    • addedOutput schema / properties / estatisticas / properties / distribuicao / properties / media / description
      Added value: +"Média aritmética"
    • addedOutput schema / properties / estatisticas / properties / distribuicao / properties / mediana / description
      Added value: +"Mediana (percentil 50, interpolação linear)"
    • addedOutput schema / properties / estatisticas / properties / distribuicao / properties / minimo / description
      Added value: +"Menor valor"
    • addedOutput schema / properties / estatisticas / properties / distribuicao / properties / percentis / description
      Added value: +"Percentis 25, 50, 75, 90, 95 e 99, cada um com o enunciado por extenso em rotulo"
    • addedOutput schema / properties / estatisticas / properties / distribuicao / properties / soma / description
      Added value: +"Soma dos valores considerados"
    • addedOutput schema / properties / estatisticas / properties / grupos / items / properties / desvioPadrao / description
      Added value: +"Desvio-padrão populacional (divide por n: os dados são censitários, não amostra)"
    • addedOutput schema / properties / estatisticas / properties / grupos / items / properties / maximo / description
      Added value: +"Maior valor"
    • addedOutput schema / properties / estatisticas / properties / grupos / items / properties / media / description
      Added value: +"Média aritmética"
    • addedOutput schema / properties / estatisticas / properties / grupos / items / properties / mediana / description
      Added value: +"Mediana (percentil 50, interpolação linear)"
    • addedOutput schema / properties / estatisticas / properties / grupos / items / properties / minimo / description
      Added value: +"Menor valor"
    • addedOutput schema / properties / estatisticas / properties / grupos / items / properties / percentis / description
      Added value: +"Percentis 25, 50, 75, 90, 95 e 99, cada um com o enunciado por extenso em rotulo"
    • addedOutput schema / properties / estatisticas / properties / grupos / items / properties / soma / description
      Added value: +"Soma dos valores considerados"
    • addedOutput schema / properties / paginacao / properties / pagina / description
      Added value: +"Página devolvida (o pedido é ajustado ao intervalo 1..totalPaginas)"
    • addedOutput schema / properties / paginacao / properties / porPagina / description
      Added value: +"Registros por página (fixo em 100)"
    • addedOutput schema / properties / paginacao / properties / temMais / description
      Added value: +"true quando há página seguinte (use pagina+1); sempre false com estatisticas=true"
    • addedOutput schema / properties / paginacao / properties / totalPaginas / description
      Added value: +"Total de páginas disponíveis"
  2. Changed9 schema fields changedv5.10.0
    • changedOutput schema / properties / provenance / description
      Previous value: -"Bloco de proveniência (contrato v1.1): fonte, URL, período, extração, diagnóstico de origem e licença"New value: +"Bloco de proveniência do portfólio: fonte, URL, período, extração, diagnóstico de origem e licença"
    • addedOutput schema / properties / provenance / properties / derivation_note
      Added value: +{
      +  "description": "O que o servidor calculou; presente junto com derived",
      +  "type": "string"
      +}
    • addedOutput schema / properties / provenance / properties / derived
      Added value: +{
      +  "description": "Presente (true) só quando o servidor calculou o valor — estatísticas, rankings, comparações — em vez de repassá-lo como veio do IBGE",
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / provenance / properties / field_sources
      Added value: +{
      +  "description": "Proveniência por sub-fonte: presente só quando a resposta junta partes extraídas de origens ou em momentos distintos, uma entrada por grupo de campos; ausente quando a resposta vem de uma única extração",
      +  "items": {
      +    "additionalProperties": false,
      +    "description": "Proveniência de um grupo de campos da resposta: de onde veio e quando foi extraído",
      +    "properties": {
      +      "data_vintage": {
      +        "description": "Vintage/competência da sub-fonte",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "dataset_id": {
      +        "description": "Identificador do conjunto da sub-fonte",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "fields": {
      +        "description": "Campos do payload atribuídos a esta sub-fonte",
      +        "items": {
      +          "type": "string"
      +        },
      +        "minItems": 1,
      +        "type": "array"
      +      },
      +      "retrieved_at": {
      +        "description": "ISO-8601 da extração desta sub-fonte na origem",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "served_from_cache": {
      +        "description": "true se esta sub-fonte veio do cache do servidor (retrieved_at é o da extração original); false se foi buscada nesta chamada; null se o servidor não distingue",
      +        "type": [
      +          "boolean",
      +          "null"
      +        ]
      +      },
      +      "source_url": {
      +        "description": "URL canônica da sub-fonte que originou estes campos",
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "fields",
      +      "source_url",
      +      "dataset_id",
      +      "data_vintage",
      +      "retrieved_at"
      +    ],
      +    "type": "object"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • addedOutput schema / properties / provenance / properties / notices
      Added value: +{
      +  "description": "Avisos que o IBGE publica junto com o dado (quebra de série, unidade, atualização), copiados como vieram; ausente quando não há aviso",
      +  "items": {
      +    "type": "string"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • changedOutput schema / properties / provenance / properties / retrieval / description
      Previous value: -"Diagnóstico de origem desta chamada (contrato v1.1): idas à API do IBGE, tentativas somadas e anomalias contornadas; unstable=true quando houve anomalia. null quando nada foi medido (resposta servida só do cache)"New value: +"Diagnóstico de origem desta chamada: idas à API do IBGE, tentativas somadas e anomalias contornadas; unstable=true quando houve anomalia. null quando nada foi medido (resposta servida só do cache)"
    • addedOutput schema / properties / provenance / properties / revision
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Se o dado ainda pode mudar no IBGE: current = versão vigente na extração, que o IBGE pode revisar depois; provisional = preliminar; final = não muda mais. note traz o específico da fonte quando há",
      +  "properties": {
      +    "note": {
      +      "description": "O específico da fonte: o que revisa, quando, por quê",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "status": {
      +      "description": "current = versão vigente, a fonte pode revisá-la; provisional = preliminar, incompleta ou sujeita a mudança (não compare como se fosse fechada); final = não muda mais, declarado pela fonte",
      +      "enum": [
      +        "current",
      +        "provisional",
      +        "final"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "note"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / unidades
      Added value: +{
      +  "description": "Unidade de medida de cada variável da resposta, FORA de `registros`: não some com `campos` nem com a paginação. Leia antes de citar um valor — 'Mil pessoas' significa que 1.234 são 1,234 milhão de pessoas",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "multiplicador": {
      +        "description": "Multiplicador de escala publicado à parte; o SIDRA não publica — sempre null, a escala está no texto da unidade",
      +        "type": [
      +          "number",
      +          "null"
      +        ]
      +      },
      +      "nomeVariavel": {
      +        "description": "Nome da variável",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "unidade": {
      +        "description": "Unidade de medida como a fonte publica, com a escala no texto (ex.: 'Mil pessoas', 'Milhões de Reais'); null se a fonte não diz",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "variavel": {
      +        "description": "Código da variável SIDRA (null se a resposta não tem a dimensão Variável)",
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      }
      +    },
      +    "required": [
      +      "variavel",
      +      "nomeVariavel",
      +      "unidade",
      +      "multiplicador"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "tabela",
      -  "nome",
      -  "totalRegistros",
      -  "colunas",
      -  "registros",
      -  "paginacao",
      -  "provenance",
      -  "attribution"
      -]New value: +[
      +  "tabela",
      +  "nome",
      +  "totalRegistros",
      +  "colunas",
      +  "registros",
      +  "unidades",
      +  "paginacao",
      +  "provenance",
      +  "attribution"
      +]
  3. Changed3 schema fields changedv5.4.0
    • changedOutput schema / properties / provenance / description
      Previous value: -"Bloco de proveniência (contrato v1.0): fonte, URL, período, extração e licença"New value: +"Bloco de proveniência (contrato v1.1): fonte, URL, período, extração, diagnóstico de origem e licença"
    • addedOutput schema / properties / provenance / properties / retrieval
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "anomalies": {
      +          "description": "Anomalias superadas até o sucesso, somadas por classe, em ordem fixa; [] se nenhuma",
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "count": {
      +                "description": "Ocorrências desta classe na chamada",
      +                "maximum": 9007199254740991,
      +                "minimum": 1,
      +                "type": "integer"
      +              },
      +              "kind": {
      +                "description": "Classe da anomalia (vocabulário fechado do contrato)",
      +                "enum": [
      +                  "timeout",
      +                  "network",
      +                  "http_4xx",
      +                  "http_5xx",
      +                  "rate_limited",
      +                  "malformed_body"
      +                ],
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "kind",
      +              "count"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "attempts": {
      +          "description": "Tentativas somadas, incluindo as repetidas (>= requests)",
      +          "maximum": 9007199254740991,
      +          "minimum": 1,
      +          "type": "integer"
      +        },
      +        "requests": {
      +          "description": "Idas distintas à origem que compõem esta resposta (fatias, páginas)",
      +          "maximum": 9007199254740991,
      +          "minimum": 1,
      +          "type": "integer"
      +        },
      +        "unstable": {
      +          "description": "true se houve repetição (attempts > requests) ou alguma anomalia",
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "requests",
      +        "attempts",
      +        "anomalies",
      +        "unstable"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "description": "Diagnóstico de origem desta chamada (contrato v1.1): idas à API do IBGE, tentativas somadas e anomalias contornadas; unstable=true quando houve anomalia. null quando nada foi medido (resposta servida só do cache)"
      +}
    • changedOutput schema / properties / provenance / required
      Previous value: -[
      -  "source",
      -  "source_url",
      -  "data_vintage",
      -  "retrieved_at",
      -  "citation",
      -  "license"
      -]New value: +[
      +  "source",
      +  "source_url",
      +  "data_vintage",
      +  "retrieved_at",
      +  "retrieval",
      +  "citation",
      +  "license"
      +]
  4. Changed2 schema fields changedv5.0.0
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / agruparPor / description
      Previous value: -"Com estatisticas=true, agrupa pela coluna informada (rótulo, ex: 'Unidade da Federação', 'Ano') e ranqueia os grupos por soma decrescente (grupos[0] = maior total), cada grupo com sua mini-distribuição"New value: +"Com estatisticas=true, agrupa pela coluna informada (rótulo, ex: 'Unidade da Federação', 'Ano') e ranqueia os grupos por soma decrescente (grupos[0] = maior total), cada grupo com sua mini-distribuição. Nome curto ('UF', 'estado', 'cidade', 'região') e rótulo parcial ('Federação') são resolvidos, e a resposta diz em `aviso` por qual coluna agrupou; rótulo que casa com duas colunas é recusado em vez de escolhido"
  5. 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"
      +]
  6. Changed12 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
    • addedInput schema / properties / agruparPor
      Added value: +{
      +  "description": "Com estatisticas=true, agrupa pela coluna informada (rótulo, ex: 'Unidade da Federação', 'Ano') e ranqueia os grupos por soma decrescente (grupos[0] = maior total), cada grupo com sua mini-distribuição",
      +  "type": "string"
      +}
    • addedInput schema / properties / estatisticas
      Added value: +{
      +  "default": false,
      +  "description": "Computa estatísticas (mínimo/máximo/média/mediana/desvio-padrão/percentis) sobre TODOS os registros da consulta, antes da paginação, + ranking top/bottom. Use para 'qual o maior/menor', 'média', 'mediana', 'distribuição', 'ranking'. Quando true, ignora pagina, campos e formato",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / pagina / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / topN
      Added value: +{
      +  "default": 10,
      +  "description": "Tamanho das listas top/bottom quando estatisticas=true sem agruparPor (padrão: 10, máx: 100)",
      +  "maximum": 100,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • 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 / estatisticas
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Bloco estatístico presente quando estatisticas=true (registros vem vazio nesse modo)",
      +  "properties": {
      +    "agrupadoPor": {
      +      "description": "Rótulo da coluna de agrupamento (com agruparPor)",
      +      "type": "string"
      +    },
      +    "aviso": {
      +      "description": "Avisos sobre agrupamento automático, mistura de unidades ou truncamento",
      +      "type": "string"
      +    },
      +    "bottom": {
      +      "description": "Menores valores (sem agruparPor)",
      +      "items": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "colunaValor": {
      +      "description": "Rótulo da coluna numérica analisada (sempre 'Valor' no SIDRA)",
      +      "type": "string"
      +    },
      +    "distribuicao": {
      +      "additionalProperties": false,
      +      "description": "Distribuição do conjunto inteiro (sem agruparPor)",
      +      "properties": {
      +        "desvioPadrao": {
      +          "type": "number"
      +        },
      +        "maximo": {
      +          "type": "number"
      +        },
      +        "media": {
      +          "type": "number"
      +        },
      +        "mediana": {
      +          "type": "number"
      +        },
      +        "minimo": {
      +          "type": "number"
      +        },
      +        "n": {
      +          "description": "Registros com valor numérico considerados",
      +          "type": "number"
      +        },
      +        "percentis": {
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "percentil": {
      +                "description": "Percentil (50 = mediana)",
      +                "type": "number"
      +              },
      +              "rotulo": {
      +                "description": "Enunciado por extenso, pronto para citar ao leitor",
      +                "type": "string"
      +              },
      +              "valor": {
      +                "type": "number"
      +              }
      +            },
      +            "required": [
      +              "percentil",
      +              "valor",
      +              "rotulo"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "soma": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "n",
      +        "soma",
      +        "minimo",
      +        "maximo",
      +        "media",
      +        "mediana",
      +        "desvioPadrao",
      +        "percentis"
      +      ],
      +      "type": "object"
      +    },
      +    "grupos": {
      +      "description": "Grupos ordenados por soma decrescente, cada um com sua mini-distribuição (com agruparPor)",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "desvioPadrao": {
      +            "type": "number"
      +          },
      +          "grupo": {
      +            "type": "string"
      +          },
      +          "maximo": {
      +            "type": "number"
      +          },
      +          "media": {
      +            "type": "number"
      +          },
      +          "mediana": {
      +            "type": "number"
      +          },
      +          "minimo": {
      +            "type": "number"
      +          },
      +          "n": {
      +            "description": "Registros com valor numérico considerados",
      +            "type": "number"
      +          },
      +          "percentis": {
      +            "items": {
      +              "additionalProperties": false,
      +              "properties": {
      +                "percentil": {
      +                  "description": "Percentil (50 = mediana)",
      +                  "type": "number"
      +                },
      +                "rotulo": {
      +                  "description": "Enunciado por extenso, pronto para citar ao leitor",
      +                  "type": "string"
      +                },
      +                "valor": {
      +                  "type": "number"
      +                }
      +              },
      +              "required": [
      +                "percentil",
      +                "valor",
      +                "rotulo"
      +              ],
      +              "type": "object"
      +            },
      +            "type": "array"
      +          },
      +          "soma": {
      +            "type": "number"
      +          }
      +        },
      +        "required": [
      +          "n",
      +          "soma",
      +          "minimo",
      +          "maximo",
      +          "media",
      +          "mediana",
      +          "desvioPadrao",
      +          "percentis",
      +          "grupo"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "registrosConsiderados": {
      +      "description": "Registros com valor numérico (contam no n)",
      +      "type": "number"
      +    },
      +    "registrosSemValor": {
      +      "description": "Registros excluídos por marcador de ausência SIDRA ('-', '..', '...', 'X') ou valor não numérico",
      +      "type": "number"
      +    },
      +    "top": {
      +      "description": "Maiores valores, com as colunas de identificação do registro (sem agruparPor)",
      +      "items": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "totalGrupos": {
      +      "description": "Total de grupos existentes antes do teto (com agruparPor)",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "colunaValor",
      +    "registrosConsiderados",
      +    "registrosSemValor"
      +  ],
      +  "type": "object"
      +}
    • 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"
      +}
    • addedOutput schema / properties / registros / items / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "tabela",
      -  "nome",
      -  "totalRegistros",
      -  "colunas",
      -  "registros",
      -  "paginacao"
      -]New value: +[
      +  "tabela",
      +  "nome",
      +  "totalRegistros",
      +  "colunas",
      +  "registros",
      +  "paginacao",
      +  "provenance",
      +  "attribution"
      +]
  7. Changed4 schema fields changedv3.0.0
    • addedInput schema / properties / campos
      Added value: +{
      +  "description": "Selecionar apenas algumas colunas por rótulo, separadas por vírgula (ex: 'Valor,Ano'). Reduz o volume da resposta. Omitir traz todas.",
      +  "type": "string"
      +}
    • changedInput schema / properties / nivel_territorial / description
      Previous value: -"Nível territorial (código N sem o prefixo):\n1=Brasil, 2=Grande Região, 3=UF, 6=Município, 7=Região Metropolitana,\n8=Mesorregião, 9=Microrregião, 10=Distrito, 11=Subdistrito,\n13=RM e RIDE, 14=Região Integrada de Desenvolvimento, 15=Aglomeração Urbana,\n17=Região Geográfica Imediata, 18=Região Geográfica Intermediária,\n105=Macrorregião de Saúde, 106=Região de Saúde,\n114=Aglomerado Subnormal, 127=Amazônia Legal, 128=Semiárido"New value: +"Nível territorial (código N): 1=Brasil, 2=Região, 3=UF, 6=Município, 7=Região Metropolitana, 8=Mesorregião, 9=Microrregião, 10=Distrito, 11=Subdistrito, 13=RM/RIDE, 14=RIDE, 15=Aglomeração Urbana, 17=Região Geográfica Imediata, 18=Região Geográfica Intermediária, 105=Macrorregião de Saúde, 106=Região de Saúde, 114=Aglomerado Subnormal, 127=Amazônia Legal, 128=Semiárido"
    • addedInput schema / properties / pagina
      Added value: +{
      +  "default": 1,
      +  "description": "Página de resultados (100 registros por página)",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "colunas": {
      +      "description": "Rótulos das colunas, na ordem",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "nome": {
      +      "description": "Nome da tabela (quando conhecido)",
      +      "type": "string"
      +    },
      +    "paginacao": {
      +      "additionalProperties": false,
      +      "description": "Metadados de paginação para continuação",
      +      "properties": {
      +        "pagina": {
      +          "type": "number"
      +        },
      +        "porPagina": {
      +          "type": "number"
      +        },
      +        "temMais": {
      +          "type": "boolean"
      +        },
      +        "totalPaginas": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "pagina",
      +        "porPagina",
      +        "totalPaginas",
      +        "temMais"
      +      ],
      +      "type": "object"
      +    },
      +    "registros": {
      +      "description": "Registros da página atual: cada um mapeia rótulo da coluna -> valor",
      +      "items": {
      +        "additionalProperties": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "tabela": {
      +      "description": "Código da tabela SIDRA consultada",
      +      "type": "string"
      +    },
      +    "totalRegistros": {
      +      "description": "Total de registros de dados disponíveis (todas as páginas)",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "tabela",
      +    "nome",
      +    "totalRegistros",
      +    "colunas",
      +    "registros",
      +    "paginacao"
      +  ],
      +  "type": "object"
      +}
  8. First observedv1.0.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/openWorld, but the description adds substantial context beyond them: values are a point-in-time snapshot with no revision history, absence markers are excluded from n, estatisticas ignores pagina/campos/formato and returns empty registros, and the Aggregates API ceiling rejects all-municipalities × 12 periods while × 8 works. It also discloses the return shape (Markdown plus typed structuredContent).

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

Conciseness3/5

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

Front-loaded with purpose and routing, which is right, but it runs very long and partly duplicates the schema: the table-code list and the territorial-level code list restate what is already in the tabela and nivel_territorial parameter descriptions. The 'What each number is' paragraph is valuable but buried mid-document rather than signposted.

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?

Complete for a 12-parameter query engine: with an output schema present, return-value shape need only be named, and it is. Revisions, source-side size limits, statistics-mode overrides, and sibling routing together cover everything an agent needs to call this correctly on the first attempt.

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 description coverage is 100%, so the baseline is 3; the description goes further by giving worked examples (tabela="6579", nivel_territorial="3", localidades="3550308") and explaining cross-parameter interactions, e.g. agruparPor ranking groups by descending sum with a named "Variável" auto-grouping when units differ. It stops short of explaining classificacoes or variaveis syntax, which the schema already covers.

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 concrete verb and resource ("Queries SIDRA tables") and immediately scopes what SIDRA contains. It explicitly positions itself as "the low-level engine" and enumerates which sibling wrappers cover which use cases, so an agent can distinguish it from ibge_censo, ibge_indicadores, ibge_comparar and ibge_cidades 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?

Gives explicit routing rules for four sibling tools plus a prerequisite step ("Use ibge_sidra_tabelas and ibge_sidra_metadados to find a table code…before querying"). It also defines when to switch on estatisticas (largest/smallest/mean/median/ranking) and when to narrow periodos or raise nivel_territorial to avoid source refusals.

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