Skip to main content
Glama

bcb_serie_valores

Retrieve historical economic data from the Brazilian Central Bank's time series database. Query indicators like IPCA, Selic, and exchange rates by code with optional date filters.

Instructions

Consulta valores de uma série temporal do BCB por código. Retorna dados históricos com data e valor.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codigoYesCódigo da série no SGS/BCB (ex: 433 para IPCA mensal, 11 para Selic)
dataInicialNoData inicial no formato yyyy-MM-dd ou dd/MM/yyyy (opcional)
dataFinalNoData final no formato yyyy-MM-dd ou dd/MM/yyyy (opcional)

Implementation Reference

  • The handler function `handleSerieValores` performs the API request to the BCB (Banco Central do Brasil) service, formats the dates, fetches the data, and returns the result.
    export async function handleSerieValores(
      args: { codigo: number; dataInicial?: string; dataFinal?: string },
      timeoutMs?: number,
      maxRetries?: number
    ): Promise<ToolResult> {
      try {
        let url = `${BCB_API_BASE}.${args.codigo}/dados?formato=json`;
        if (args.dataInicial) url += `&dataInicial=${formatDateForApi(args.dataInicial)}`;
        if (args.dataFinal) url += `&dataFinal=${formatDateForApi(args.dataFinal)}`;
    
        const data = await fetchBcbApi(url, timeoutMs, maxRetries) as SerieValor[];
    
        if (!Array.isArray(data) || data.length === 0) {
          return {
            content: [{ type: "text" as const, text: `Nenhum dado encontrado para a série ${args.codigo} no período solicitado.` }]
          };
        }
    
        const serieInfo = SERIES_POPULARES.find(s => s.codigo === args.codigo);
        const result = {
          serie: {
            codigo: args.codigo,
            nome: serieInfo?.nome || `Série ${args.codigo}`,
            categoria: serieInfo?.categoria || "Desconhecida",
            periodicidade: serieInfo?.periodicidade || "Desconhecida"
          },
          totalRegistros: data.length,
          periodoInicial: data[0].data,
          periodoFinal: data[data.length - 1].data,
          dados: data.map(d => ({ data: d.data, valor: parseFloat(d.valor) }))
        };
    
        return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] };
      } catch (error) {
        return {
          content: [{ type: "text" as const, text: `Erro ao consultar série ${args.codigo}: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true
        };
      }
    }
  • The tool definition for `bcb_serie_valores` includes its name, description, and input schema (requiring a `codigo`, with optional `dataInicial` and `dataFinal`).
    {
      name: "bcb_serie_valores",
      description: "Consulta valores de uma série temporal do BCB por código. Retorna dados históricos com data e valor.",
      inputSchema: {
        type: "object" as const,
        properties: {
          codigo: { type: "number" as const, description: "Código da série no SGS/BCB (ex: 433 para IPCA mensal, 11 para Selic)" },
          dataInicial: { type: "string" as const, description: "Data inicial no formato yyyy-MM-dd ou dd/MM/yyyy (opcional)" },
          dataFinal: { type: "string" as const, description: "Data final no formato yyyy-MM-dd ou dd/MM/yyyy (opcional)" }
        },
        required: ["codigo"]
      }
  • src/tools.ts:846-847 (registration)
    The tool `bcb_serie_valores` is registered within the `dispatchTool` switch statement to map the tool name to the handler function.
    case "bcb_serie_valores":
      return handleSerieValores(args as { codigo: number; dataInicial?: string; dataFinal?: string }, timeoutMs, maxRetries);
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool returns historical data with date and value, which is useful, but lacks critical behavioral details: it doesn't mention rate limits, authentication needs, error handling, data format specifics, or whether the query is read-only (implied but not confirmed). For a tool with no annotations, this leaves significant gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded: two sentences that directly state the tool's function and return value. There is zero waste or redundancy, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is minimally complete. It covers the basic purpose and return type (historical data with date and value), but lacks details on output structure, error cases, or behavioral constraints. For a query tool with 3 parameters, this is adequate but leaves clear gaps that could hinder effective use.

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

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value beyond the schema: it mentions 'por código' (by code) which aligns with the 'codigo' parameter, but doesn't provide additional context like example codes beyond what's in the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Consulta valores de uma série temporal do BCB por código' (Query values of a BCB time series by code). It specifies the action (consulta/query), resource (valores/series temporais), and scope (BCB). However, it doesn't explicitly differentiate from sibling tools like 'bcb_serie_ultimos' or 'bcb_indicadores_atuais' that might also retrieve time series data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'bcb_serie_ultimos' (likely for recent data) or 'bcb_serie_metadados' (for metadata), nor does it specify prerequisites or exclusions. Usage is implied through the description but not explicitly stated.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SidneyBissoli/bcb-br-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server