Skip to main content
Glama

Detalhes de localidade

ibge_localidade
Read-onlyIdempotent

Fetch full details of a Brazilian state, municipality, or district by IBGE code, including hierarchy, region, mesoregion, and microregion.

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

TableJSON 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

TableJSON 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 (contrato v1.0): fonte, URL, período, extração 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. Changed1 schema field changedv5.0.0
    • addedInput schema / additionalProperties
      Added value: +false
  2. 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"
      +]
  3. 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"
      +]
  4. 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"
      +}
  5. First observedv1.0.0

TDQS

A4.6/5.0
Behavior4/5

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

The annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint, so the description does not need to restate safety. It adds genuine value beyond them by naming the backing source ('live GET against the public IBGE Localidades API') and the return format ('Markdown record'). It does not mention any rate limits or auth requirements, which are minor for a public API.

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-loads the purpose, then organizes the remainder into labeled Features, Examples, When-to-use, and Behavior blocks. Every section is short and actionable; the concrete code examples partially duplicate the schema's digit-length note, but they remain useful for disambiguation.

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 not be enumerated; the description still notes the Markdown format. Combined with the hierarchy explanation, the code examples, and the sibling routing rules, an agent has everything needed to call this correctly for a three-level locality lookup.

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% and the schema already documents both 'codigo' digit lengths and the 'tipo' enum with inference from code length, so the baseline is 3. The description's concrete examples (São Paulo state=35, city=3550308, district=355030805) add grounded meaning by mapping real entities onto the abstract code lengths, marginally exceeding the schema.

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 immediately clarifies scope with the exact code lengths for state, municipality, and district levels. It explicitly distinguishes itself from siblings by name ('Use a different tool when... ibge_municipios or ibge_geocodigo'), so an agent can route correctly 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?

Provides an explicit selection condition ('returns the full record of ONE locality you already have the code for') and pairs it with two named alternatives for the opposite cases (having a name, wanting to decompose a code). This is textbook when-to-use / when-not-to-use guidance with named siblings.

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