Skip to main content
Glama
SidneyBissoli

Banco Central do Brasil (BCB) — SGS MCP

Últimos valores da série

bcb_serie_ultimos
Read-onlyIdempotent

Retrieve the last N observations from one BCB SGS time series, newest first, without date calculations. Use it for recent values like the last 12 IPCA months.

Instructions

Obtém as últimas N observações de UMA série temporal do BCB (mais recentes primeiro a partir do fim da série). Quando usar: para ver os dados mais recentes sem precisar calcular datas (ex.: últimos 12 meses do IPCA). Quantidade entre 1 e 1000 (padrão 10). Quando NÃO usar: para um intervalo de datas ou o histórico completo use bcb_serie_valores. Retorna: objeto serie, totalRegistros e dados (array de {data, valor}); sem dados, totalRegistros = 0 com observacao. Acima de 20: o endpoint nativo do BCB rejeita N > 20 em qualquer periodicidade, então o servidor descobre a periodicidade da série e busca por janela de datas, devolvendo os N últimos pontos. Comportamento: consome a API pública SGS do Banco Central do Brasil — sem autenticação, chave de API ou cadastro, e sem limite de requisições divulgado (uso é best-effort). Em falha transitória ou timeout a chamada é repetida automaticamente (até 3 tentativas, backoff exponencial); persistindo o erro, retorna isError: true com mensagem em português (HTTP 404 = série inexistente ou sem dados no período solicitado). O resultado vem como JSON tanto em texto quanto em structuredContent (conforme o outputSchema); datas no formato dd/MM/yyyy e valores numéricos (ponto decimal).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codigoYesCódigo da série no SGS/BCB
quantidadeNoQuantidade de valores a retornar (1-1000, padrão: 10). A API do BCB tem teto de 20 no endpoint nativo; acima disso o servidor busca por janela de datas e devolve os N últimos.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dadosYesObservações mais recentes
serieYesIdentificação da série temporal
chunkingNoPresente quando a consulta foi fatiada em várias requisições à origem, por causa do limite de 10 anos por janela em séries diárias. As fatias são fundidas e ordenadas antes de responder.
observacaoNoMensagem informativa (ex.: quando não há dados)
provenanceYesBloco de proveniência (contrato v1.1): fonte, URL, competência, extração, diagnóstico de origem, citação e licença
attributionYesURLs canônicas das fontes desta resposta (lista de atribuição)
totalRegistrosYesQuantidade de observações retornadas

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changedv1.15.0
    • changedOutput schema / properties / provenance / description
      Previous value: -"Bloco de proveniência (contrato v1.0): fonte, URL, competência, extração e licença"New value: +"Bloco de proveniência (contrato v1.1): fonte, URL, competência, extração, diagnóstico de origem, citação e licença"
    • changedOutput schema / properties / provenance / properties / citation / description
      Previous value: -"Citação pronta para uso"New value: +"Citação/atribuição pronta para uso"
    • changedOutput schema / properties / provenance / properties / data_vintage / description
      Previous value: -"Competência do dado segundo a fonte; null quando a fonte não expõe"New value: +"Competência/vintage do dado segundo a fonte; null quando a fonte não expõe"
    • changedOutput schema / properties / provenance / properties / license / description
      Previous value: -"Regime legal do dado"New value: +"Regime legal do dado (id SPDX quando há, senão o nome da licença)"
    • addedOutput schema / properties / provenance / properties / retrieval
      Added value: +{
      +  "description": "Diagnóstico de origem da chamada: como o dado foi obtido. Medição real do servidor; unstable=true pede ao agente que trate o dado como obtido com dificuldade; null quando o servidor não mede",
      +  "oneOf": [
      +    {
      +      "additionalProperties": false,
      +      "description": "Diagnóstico de origem da chamada: como o dado foi obtido. Medição real do servidor; unstable=true pede ao agente que trate o dado como obtido com dificuldade",
      +      "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",
      +                "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)",
      +          "minimum": 1,
      +          "type": "integer"
      +        },
      +        "requests": {
      +          "description": "Idas distintas à origem que compõem esta resposta (fatias, páginas)",
      +          "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"
      +    }
      +  ]
      +}
    • changedOutput schema / properties / provenance / properties / retrieved_at / description
      Previous value: -"Instante REAL da extração na origem (ISO-8601, horário de Brasília). Resposta servida de cache mantém o instante do fetch ORIGINAL, que é a data de extração relevante."New value: +"Instante REAL da extração na origem (ISO-8601, fuso do servidor). Resposta servida de cache mantém o instante do fetch original, que é a data de extração relevante"
    • changedOutput schema / properties / provenance / properties / source_url / description
      Previous value: -"URL canônica que reproduz a consulta"New value: +"URL canônica que reproduz a consulta na fonte"
    • 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"
      +]
  2. Changed3 schema fields changedv1.9.2
    • 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, competência, extração e licença",
      +  "properties": {
      +    "citation": {
      +      "description": "Citação pronta para uso",
      +      "type": "string"
      +    },
      +    "data_vintage": {
      +      "description": "Competência do dado segundo a fonte; null quando a fonte não expõe",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "license": {
      +      "description": "Regime legal do dado",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "retrieved_at": {
      +      "description": "Instante REAL da extração na origem (ISO-8601, horário de Brasília). Resposta servida de cache mantém o instante do fetch ORIGINAL, que é a data de extração relevante.",
      +      "type": "string"
      +    },
      +    "source": {
      +      "description": "Fonte oficial do dado",
      +      "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: -[
      -  "serie",
      -  "totalRegistros",
      -  "dados"
      -]New value: +[
      +  "serie",
      +  "totalRegistros",
      +  "dados",
      +  "provenance",
      +  "attribution"
      +]
  3. Changed7 schema fields changedv1.6.0
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • changedInput schema / properties / quantidade / description
      Previous value: -"Quantidade de valores a retornar (1-1000, padrão: 10)"New value: +"Quantidade de valores a retornar (1-1000, padrão: 10). A API do BCB tem teto de 20 no endpoint nativo; acima disso o servidor busca por janela de datas e devolve os N últimos."
    • removedOutput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • addedOutput schema / properties / chunking
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Presente quando a consulta foi fatiada em várias requisições à origem, por causa do limite de 10 anos por janela em séries diárias. As fatias são fundidas e ordenadas antes de responder.",
      +  "properties": {
      +    "fatiaAnos": {
      +      "description": "Largura máxima de cada janela, em anos",
      +      "type": "number"
      +    },
      +    "janelas": {
      +      "description": "Quantidade de janelas consultadas",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "janelas",
      +    "fatiaAnos"
      +  ],
      +  "type": "object"
      +}
    • addedOutput schema / properties / serie / description
      Added value: +"Identificação da série temporal"
    • changedOutput schema / properties / serie / properties / periodicidade / description
      Previous value: -"Periodicidade da série"New value: +"Periodicidade (Diária, Mensal, etc.)"
    • addedOutput schema / properties / serie / properties / periodicidadeInferida
      Added value: +{
      +  "description": "Presente e true quando a periodicidade foi inferida do espaçamento das observações, e não lida do catálogo — a API do SGS não publica metadados de série.",
      +  "type": "boolean"
      +}
  4. Changed1 schema field changedv1.3.5
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "dados": {
      +      "description": "Observações mais recentes",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "data": {
      +            "description": "Data da observação (dd/MM/yyyy)",
      +            "type": "string"
      +          },
      +          "valor": {
      +            "description": "Valor numérico da observação",
      +            "type": "number"
      +          }
      +        },
      +        "required": [
      +          "data",
      +          "valor"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "observacao": {
      +      "description": "Mensagem informativa (ex.: quando não há dados)",
      +      "type": "string"
      +    },
      +    "serie": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "categoria": {
      +          "description": "Categoria econômica",
      +          "type": "string"
      +        },
      +        "codigo": {
      +          "description": "Código da série no SGS/BCB",
      +          "type": "number"
      +        },
      +        "nome": {
      +          "description": "Nome da série",
      +          "type": "string"
      +        },
      +        "periodicidade": {
      +          "description": "Periodicidade da série",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "codigo",
      +        "nome"
      +      ],
      +      "type": "object"
      +    },
      +    "totalRegistros": {
      +      "description": "Quantidade de observações retornadas",
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "serie",
      +    "totalRegistros",
      +    "dados"
      +  ],
      +  "type": "object"
      +}
  5. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare readOnlyHint=true, openWorldHint=true, idempotentHint=true, and destructiveHint=false, but the description adds substantial behavioral context beyond these: the native BCB API limit of 20 and the server's workaround for larger N, automatic retry logic (up to 3 attempts with exponential backoff), error response shape with isError flag and HTTP 404 mapping, and output format details (JSON, dd/MM/yyyy dates, decimal point). This enriches the agent's understanding of side effects and failure modes well beyond the annotations.

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?

The description is fairly long but well-structured with clear sections (purpose, usage, return info, behavior, error handling). Every sentence carries necessary information—there is no filler. The length is justified by the complexity of the tool's behavior (limit handling, retries, error responses). It is front-loaded with the core purpose, making it easy to scan.

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?

For a tool with only 2 parameters, an output schema, and rich annotations, the description covers all essential aspects: when to use, when not, parameter limits, native API constraints, retry behavior, error handling, and output structure. The agent has everything needed to call this tool correctly and interpret results, including edge cases like empty data (totalRegistros=0 with observacao).

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?

Both parameters are already fully described in the schema (100% coverage), so the baseline is 3. The description adds significant extra context for 'quantidade' by explaining the native endpoint cap of 20 and the server-side workaround that fetches by date window to return the N most recent points. This is not present in the schema and is crucial for correct usage, raising the score above baseline.

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 description opens with a specific verb and resource: 'Obtém as últimas N observações de UMA série temporal do BCB', clearly stating the scope and distinguishing it from the sibling bcb_serie_valores by noting it returns the most recent values without date calculation. The purpose is unambiguous and immediately differentiates from alternatives.

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?

The description explicitly states 'Quando usar' (when to use) with a concrete example (últimos 12 meses do IPCA) and 'Quando NÃO usar' (when not to use), naming the exact alternative tool bcb_serie_valores for date ranges or full history. This provides clear selection criteria for the agent.

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