Skip to main content
Glama

Banco Central do Brasil (BCB) — SGS Time Series MCP Server

Comparar séries

bcb_comparar
Read-onlyIdempotent

Compara de 2 a 5 séries temporais no MESMO período (dataInicial e dataFinal obrigatórias), calculando a variação percentual de cada uma e ordenando-as num ranking (maior para menor variação). Série de nível entra pela variação entre as pontas; série que já é variação por período (IPCA, INPC, IGP-M mensais do catálogo; Selic/CDI acumulados no mês; poupança) entra pelo ACUMULADO encadeado do período — cada item diz em metodo qual conta foi feita, então "qual índice de preço subiu mais em 2024" é esta tool. Quando usar: para comparar/correlacionar a evolução de vários indicadores lado a lado. Quando NÃO usar: para uma única série use bcb_variacao. Retorna: periodo, totalSeries, seriesComDados, seriesComErro, ranking (cada item com posicao, codigo, nome, metodo, valorInicial, valorFinal, variacaoPercentual, maximo, minimo, media) e erros. Resiliente: séries sem dados no período, e séries de acumulado móvel (IPCA em 12 meses), são isoladas em erros sem invalidar a comparação. Periodicidades diferentes: comparar uma série diária com uma mensal alinha pontos que não são comparáveis, e a resposta avisa isso em aviso; informe frequencia (mensal|trimestral|anual) para harmonizar todas na mesma grade antes de comparar, escolhendo a convenção em agregacao. Janelas longas em séries diárias são fatiadas automaticamente (limite de 10 anos da API do BCB). 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
codigosYesArray com 2 a 5 códigos de séries para comparar
agregacaoNoComo agregar os valores de cada período quando `frequencia` é informada. `ultimo` (padrão) serve a nível de preço, taxa e índice; `soma` a fluxo; `acumulada` a séries que JÁ SÃO variação percentual (IPCA mensal, por exemplo), compondo geometricamente — somar 12 variações mensais NÃO dá a inflação do ano.ultimo
dataFinalYesData final (yyyy-MM-dd ou dd/MM/yyyy)
frequenciaNoOpcional: reamostra a série para esta frequência antes de responder (só agrega para períodos MAIORES; pedir frequência mais fina que a da série é recusado). Útil para comparar séries de periodicidades diferentes.
dataInicialYesData inicial (yyyy-MM-dd ou dd/MM/yyyy)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
avisoNoPresente quando as séries comparadas têm periodicidades diferentes e nenhuma harmonização foi pedida — os números do ranking, nesse caso, não são diretamente comparáveis entre si.
errosYesSéries que não retornaram dados, com o motivo
periodoYesJanela temporal comparada
rankingYesSéries ordenadas pela variação percentual (maior para menor)
derivacaoYesOrigem dos números calculados: o que é derivado, por qual motor e com quais convenções
provenanceYesBloco de proveniência (contrato v1.0): fonte, URL, competência, extração e licença
attributionYesURLs canônicas das fontes desta resposta (lista de atribuição)
totalSeriesYesQuantidade de séries solicitadas
harmonizacaoNoPresente quando `frequencia` foi informada: descreve a reamostragem aplicada. Valor DERIVADO — calculado por este servidor, não publicado pelo Banco Central.
seriesComErroYesQuantidade de séries sem dados ou com erro
seriesComDadosYesQuantidade de séries com dados no período

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/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, destructiveHint=false, and the description is fully consistent with these. Beyond the annotations, it discloses substantial behavior: how each series type is computed (level via endpoints, period-variation via chained accumulation with `metodo` in each item), resilience behavior (empty series and 12-month moving IPCA isolated in `erros` without invalidating the comparison), auto-slicing of long daily windows at the BCB's 10-year API limit, retry policy (up to 3 attempts, exponential backoff), the best-effort no-auth nature of the SGS API, and error semantics (isError with Portuguese message, 404 meaning). This is rich, decision-relevant behavioral context that no structured field conveys.

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 long but every sentence earns its place given the tool's complexity (5 parameters, mixed series semantics, aggregation conventions, multiple edge cases). It is well-structured and front-loaded: the core purpose and main output shape lead, followed by when-to-use, return structure, resilience, periodicity handling, API behavior, and output format. A small amount of trimming would be possible (e.g., the retry mechanics could be condensed), but it is organized logically and dense with signal rather than padded.

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 this complexity — comparison logic, two series-semantic families, aggregation enum, periodicity harmonization, API constraints, and error handling — the description is remarkably complete. It covers the full invoke decision surface: required date range, the 2-5 code constraint, the ranking return shape, edge cases (data gaps, moving-average series, mismatched periodicities, long windows), transport behavior (no auth, retries, 404 semantics), and output conventions (JSON in text and structuredContent, dd/MM/yyyy dates). With an output schema present, it need not enumerate return values further; nothing an agent needs to call this correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/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 genuinely non-obvious semantics beyond the schema. For `agregacao`, it explains the mapping: `ultimo` suits level/price/tax/index series, `soma` suits flows, and `acumulada` is for series that are ALREADY percentage variation — with the critical warning that 'somar 12 variações mensais NÃO dá a inflação do ano' (geometric composition required). For `frequencia`, it clarifies that it only aggregates to larger periods and that finer requests are refused. The description also reinforces that dataInicial/dataFinal are mandatory, matching the schema's required array.

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: 'Compara de 2 a 5 séries temporais no MESMO período', then states the exact computation (variação percentual) and output shape (ranking ordenado). It explicitly differentiates from a sibling: 'para uma única série use bcb_variacao', and gives a concrete example scenario ('qual índice de preço subiu mais em 2024 é esta tool'). An agent can select this tool and distinguish it from bcb_variacao 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?

The description provides explicit selection criteria with both positive and negative framing: 'Quando usar: para comparar/correlacionar a evolução de vários indicadores lado a lado' and 'Quando NÃO usar: para uma única série use bcb_variacao'. It also gives conditional guidance for the `frequencia` parameter ('Útil para comparar séries de periodicidades diferentes') and warns against requesting a finer frequency than the series. This is model usage-guideline content.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.