Skip to main content
Glama

Detalhes de localidade

ibge_localidade
Read-onlyIdempotent

Retrieve full state, municipality, or district details and complete hierarchy by IBGE code. Use it when you already have a code and need the locality record.

Instructions

Returns details of a specific locality by IBGE code.

Features:

  • State information (2-digit code)

  • Municipality information (7-digit code)

  • District information (9-digit code)

  • Complete hierarchy (region, mesoregion, microregion)

Examples:

  • São Paulo state: codigo=35

  • São Paulo city: codigo=3550308

  • District: codigo=355030805

This tool returns the full record of ONE locality you already have the code for. Use a different tool when:

  • You have a name and need the code → ibge_municipios (municipalities) or ibge_geocodigo (any level)

  • You want to decompose/understand a code's structure → ibge_geocodigo

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

Input Schema

NameRequiredDescriptionDefault
tipoNoTipo da localidade. Se não informado, será inferido pelo tamanho do código.
codigoYesCódigo IBGE da localidade (estado: 2 dígitos, município: 7 dígitos, distrito: 9 dígitos)

Output Schema

NameRequiredDescriptionDefault
idYesCódigo IBGE da localidade
nomeYesNome da localidade
tipoYesTipo da localidade retornada
siglaNoSigla da UF (apenas para estados)
estadoNoEstado da localidade (município ou distrito)
regiaoNoRegião do estado (apenas para estados)
municipioNoMunicípio ao qual o distrito pertence (apenas para distritos)
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)
mesorregiaoNoMesorregião do município
microrregiaoNoMicrorregião do município
regiaoImediataNoRegião imediata do município
regiaoIntermediariaNoRegião intermediária do município

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 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"
      +}
  2. 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"
      +]
  3. Changed1 schema field changedv5.0.0
    • addedInput schema / additionalProperties
      Added value: +false
  4. 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"
      +]
  5. 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: -[
      -  "tipo",
      -  "id",
      -  "nome"
      -]New value: +[
      +  "tipo",
      +  "id",
      +  "nome",
      +  "provenance",
      +  "attribution"
      +]
  6. Changed1 schema field changedv3.0.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "estado": {
      +      "additionalProperties": false,
      +      "description": "Estado da localidade (município ou distrito)",
      +      "properties": {
      +        "id": {
      +          "description": "Código IBGE do estado",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome do estado",
      +          "type": "string"
      +        },
      +        "sigla": {
      +          "description": "Sigla da UF",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "sigla",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "id": {
      +      "description": "Código IBGE da localidade",
      +      "type": "number"
      +    },
      +    "mesorregiao": {
      +      "additionalProperties": false,
      +      "description": "Mesorregião do município",
      +      "properties": {
      +        "id": {
      +          "description": "Código IBGE da mesorregião",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome da mesorregião",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "microrregiao": {
      +      "additionalProperties": false,
      +      "description": "Microrregião do município",
      +      "properties": {
      +        "id": {
      +          "description": "Código IBGE da microrregião",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome da microrregião",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "municipio": {
      +      "additionalProperties": false,
      +      "description": "Município ao qual o distrito pertence (apenas para distritos)",
      +      "properties": {
      +        "id": {
      +          "description": "Código IBGE do município",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome do município",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "nome": {
      +      "description": "Nome da localidade",
      +      "type": "string"
      +    },
      +    "regiao": {
      +      "additionalProperties": false,
      +      "description": "Região do estado (apenas para estados)",
      +      "properties": {
      +        "id": {
      +          "description": "Código IBGE da região",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome da região",
      +          "type": "string"
      +        },
      +        "sigla": {
      +          "description": "Sigla da região",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "sigla",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "regiaoImediata": {
      +      "additionalProperties": false,
      +      "description": "Região imediata do município",
      +      "properties": {
      +        "id": {
      +          "description": "Código IBGE da região imediata",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome da região imediata",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "regiaoIntermediaria": {
      +      "additionalProperties": false,
      +      "description": "Região intermediária do município",
      +      "properties": {
      +        "id": {
      +          "description": "Código IBGE da região intermediária",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome da região intermediária",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "sigla": {
      +      "description": "Sigla da UF (apenas para estados)",
      +      "type": "string"
      +    },
      +    "tipo": {
      +      "description": "Tipo da localidade retornada",
      +      "enum": [
      +        "estado",
      +        "municipio",
      +        "distrito"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "tipo",
      +    "id",
      +    "nome"
      +  ],
      +  "type": "object"
      +}
  7. First observedv1.0.0

TDQS

A4.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so the description's 'read-only and idempotent' line earns no credit. It does add the live GET against the public IBGE Localidades API and a Markdown return record, but since an output schema exists the return-format note is marginal, leaving only modest value beyond the structured fields.

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-loaded with the core purpose, then features, examples, routing rules and behavior in clearly labeled blocks; every section is useful. Slight waste in restating the read-only/idempotent annotations already covered by structured fields.

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 rich annotations, 100% schema coverage and an output schema in place, the description only needs to cover purpose, routing and input formatting — all of which it does, including sibling disambiguation and code examples.

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 concrete worked examples of valid codigo values at each level (35, 3550308, 355030805) and repeats the size-based inference for the optional tipo, which helps an agent format a call correctly beyond the schema text.

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 ('Returns details of a specific locality by IBGE code') and explicitly names the sibling tools it is not (ibge_municipios, ibge_geocodigo) plus the scenario it doesn't serve. An agent can distinguish it without opening any 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?

Contains an explicit 'Use a different tool when' block with two conditions and the correct alternative for each (name-to-code, code decomposition). The precondition 'you already have the code for' is stated outright, leaving nothing to inference.

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