Skip to main content
Glama

Malhas geográficas

ibge_malhas
Read-onlyIdempotent

Get geographic meshes from IBGE in GeoJSON, TopoJSON, or SVG for Brazil, regions, states, or municipalities, with selectable internal divisions and cartographic metadata.

Instructions

Gets geographic meshes (maps) from IBGE in GeoJSON, TopoJSON, or SVG format.

Features:

  • Meshes for Brazil, regions, states, municipalities

  • Different resolution levels (internal divisions)

  • Different quality levels

  • Formats: GeoJSON (data), TopoJSON (compact), SVG (image)

  • Structured cartographic summary for geometric responses: feature count, geometry types, bbox, vertex centroid, and property keys

Locality types:

  • "BR" or "1" = Entire Brazil

  • State abbreviation (e.g., "SP", "RJ")

  • State code (e.g., "35" for SP)

  • Municipality code (7 digits)

Resolution (internal divisions):

  • 0 = Outline only

  • 2 = States

  • 5 = Municipalities

Examples:

  • Brazil with states: localidade="BR", resolucao="2"

  • São Paulo with municipalities: localidade="SP", resolucao="5"

  • SVG format: localidade="BR", formato="svg"

Use a different tool when:

  • Thematic meshes (biomes, Legal Amazon, semi-arid, metropolitan regions) → ibge_malhas_tema

Behavior: read-only and idempotent — a live GET against the public IBGE Malhas API. The full geometry remains in the Markdown/download channel; structuredContent carries lightweight cartographic metadata only.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "localidade": "<localidade>"
    },
    "name": "ibge_malhas"
  }
}

Input Schema

NameRequiredDescriptionDefault
tipoNoTipo de divisão territorial
formatoNoFormato de saída (padrão: geojson)geojson
qualidadeNoQualidade do traçado: 'minima', 'intermediaria' ou 'maxima' (padrão). Os números 1–4 do IBGE antigo continuam aceitos e são traduzidos.maxima
resolucaoNoDivisões internas a desenhar dentro da malha pedida: 0 = Sem divisões internas (só o contorno) 1 = Macrorregiões (apenas quando localidade=BR) 2 = Unidades da Federação (BR ou uma região) 3 = Mesorregiões 4 = Microrregiões 5 = Municípios Cada nível aceita só as divisões menores que ele: município aceita nenhuma, UF aceita 3, 4 e 5.0
localidadeYesCódigo IBGE ou sigla da localidade (ex: 'BR', 'SP', '35', '3550308')
intrarregiaoNoDivisão interna pelo nome, alternativa a resolucao: 'regiao', 'UF', 'regiao-intermediaria', 'regiao-imediata', 'mesorregiao', 'microrregiao' ou 'municipio'. Quando informado, prevalece sobre resolucao.

Output Schema

NameRequiredDescriptionDefault
urlNoURL para download da malha completa
tipoNoTipo de divisão territorial, quando informado
formatoYesFormato de saída solicitado (geojson, topojson ou svg)
qualidadeNoQualidade do traçado solicitada
resolucaoNoResolução/divisões internas solicitada
localidadeYesCódigo IBGE ou sigla da localidade consultada
provenanceYesBloco de proveniência (contrato v1.1): fonte, URL, período, extração e licença
attributionYesURLs canônicas das fontes desta resposta (lista de atribuição)
intrarregiaoNoDivisão interna desenhada dentro da malha (vocabulário da API v3)
resumo_geometricoNoResumo cartográfico derivado da geometria retornada

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed15 schema fields changedv0.7.2
    • 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 e licença"
    • removedOutput schema / properties / provenance / properties / citation / description
      Removed value: -"Citação pronta para uso"
    • removedOutput schema / properties / provenance / properties / data_vintage / description
      Removed value: -"Período de referência do dado segundo a fonte; null se a fonte não expõe"
    • addedOutput schema / properties / provenance / properties / derivation_note
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / provenance / properties / derived
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / provenance / properties / field_sources
      Added value: +{
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "data_vintage": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "dataset_id": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "fields": {
      +        "items": {
      +          "type": "string"
      +        },
      +        "minItems": 1,
      +        "type": "array"
      +      },
      +      "retrieved_at": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "served_from_cache": {
      +        "type": [
      +          "boolean",
      +          "null"
      +        ]
      +      },
      +      "source_url": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "fields",
      +      "source_url",
      +      "dataset_id",
      +      "data_vintage",
      +      "retrieved_at"
      +    ],
      +    "type": "object"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedOutput schema / properties / provenance / properties / license / description
      Removed value: -"Regime legal do dado"
    • addedOutput schema / properties / provenance / properties / notices
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • addedOutput schema / properties / provenance / properties / retrieval
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": false,
      +      "properties": {
      +        "anomalies": {
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "count": {
      +                "maximum": 9007199254740991,
      +                "minimum": 1,
      +                "type": "integer"
      +              },
      +              "kind": {
      +                "enum": [
      +                  "timeout",
      +                  "network",
      +                  "http_4xx",
      +                  "http_5xx",
      +                  "rate_limited",
      +                  "malformed_body"
      +                ],
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "kind",
      +              "count"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "attempts": {
      +          "maximum": 9007199254740991,
      +          "minimum": 1,
      +          "type": "integer"
      +        },
      +        "requests": {
      +          "maximum": 9007199254740991,
      +          "minimum": 1,
      +          "type": "integer"
      +        },
      +        "unstable": {
      +          "type": "boolean"
      +        }
      +      },
      +      "required": [
      +        "requests",
      +        "attempts",
      +        "anomalies",
      +        "unstable"
      +      ],
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • removedOutput schema / properties / provenance / properties / retrieved_at / description
      Removed value: -"Instante real da extração no upstream (ISO-8601, horário de Brasília)"
    • addedOutput schema / properties / provenance / properties / revision
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "note": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "status": {
      +      "enum": [
      +        "current",
      +        "provisional",
      +        "final"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "status",
      +    "note"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / properties / provenance / properties / source / description
      Removed value: -"Fonte oficial do dado (API do IBGE consultada)"
    • removedOutput schema / properties / provenance / properties / source_url / description
      Removed value: -"URL canônica que reproduz a consulta"
    • 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"
      +]
    • addedOutput schema / properties / resumo_geometrico
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Resumo cartográfico derivado da geometria retornada",
      +  "properties": {
      +    "bbox": {
      +      "description": "[longitude mínima, latitude mínima, longitude máxima, latitude máxima]",
      +      "items": false,
      +      "maxItems": 4,
      +      "minItems": 4,
      +      "prefixItems": [
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "number"
      +        },
      +        {
      +          "type": "number"
      +        }
      +      ],
      +      "type": "array"
      +    },
      +    "centroide": {
      +      "additionalProperties": false,
      +      "description": "Centróide dos vértices da malha, em longitude/latitude",
      +      "properties": {
      +        "latitude": {
      +          "type": "number"
      +        },
      +        "longitude": {
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "longitude",
      +        "latitude"
      +      ],
      +      "type": "object"
      +    },
      +    "feicoes": {
      +      "description": "Quantidade de feições na resposta",
      +      "maximum": 9007199254740991,
      +      "minimum": 0,
      +      "type": "integer"
      +    },
      +    "propriedades": {
      +      "description": "Chaves de propriedades observadas nas feições retornadas",
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "tipos_geometria": {
      +      "additionalProperties": {
      +        "maximum": 9007199254740991,
      +        "minimum": 0,
      +        "type": "integer"
      +      },
      +      "description": "Contagem por tipo de geometria",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    }
      +  },
      +  "required": [
      +    "feicoes",
      +    "tipos_geometria",
      +    "propriedades"
      +  ],
      +  "type": "object"
      +}
  2. First observedv0.6.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive/openWorld, but the description adds non-obvious behavior: that the call is a live GET against the public IBGE Malhas API and that full geometry lands in the Markdown/download channel while structuredContent carries only lightweight cartographic metadata (feature count, geometry types, bbox, vertex centroid, property keys). This channel-split detail is exactly the kind of behavioral context annotations cannot convey.

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?

Well front-loaded — purpose sentence first, then grouped sections (Features, Locality types, Resolution, Examples, Use a different tool when). The block structure makes it scannable, though it is on the longer side and repeats some enum information already in the schema.

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?

There is an output schema, so return-value detail is not required, and the description nevertheless notes what structuredContent contains. Combined with the behavior note, format distinctions, locality formats, resolution mapping, and sibling routing, an agent has everything needed to invoke this correctly.

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 baseline 3, but the description adds real semantics: it spells out accepted localidade forms ("BR", state abbreviation, state code, 7-digit municipality code) with examples, and clarifies what each format means (GeoJSON=data, TopoJSON=compact, SVG=image) and resolution levels. It does not add much for tipo, qualidade, or intrarregiao, which stay in 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?

Opens with a specific verb+resource ("Gets geographic meshes (maps) from IBGE") and names the output formats, so the agent immediately knows this returns cartographic geometry. It distinguishes itself from the sibling ibge_malhas_tema by scoping to standard IBGE meshes and routing thematic meshes elsewhere.

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?

Provides an explicit "Use a different tool when" block naming ibge_malhas_tema for thematic meshes, plus worked examples that show valid parameter combinations. It does not cover other plausible alternatives in the large sibling set (e.g., ibge_mapa or ibge_municipios), so routing guidance is clear but not exhaustive.

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