Skip to main content
Glama

bcb_serie_ultimos

Retrieve recent time series values from the Brazilian Central Bank's economic database. Specify a series code and quantity to access current economic indicators.

Instructions

Obtém os últimos N valores de uma série temporal do BCB. Útil para consultar dados mais recentes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codigoYesCódigo da série no SGS/BCB
quantidadeNoQuantidade de valores a retornar (1-1000, padrão: 10)

Implementation Reference

  • The `handleSerieUltimos` function fetches the latest N data points for a BCB series from the API.
    export async function handleSerieUltimos(
      args: { codigo: number; quantidade: number },
      timeoutMs?: number,
      maxRetries?: number
    ): Promise<ToolResult> {
      try {
        const url = `${BCB_API_BASE}.${args.codigo}/dados/ultimos/${args.quantidade}?formato=json`;
        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}.` }]
          };
        }
    
        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,
          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 últimos valores da série ${args.codigo}: ${error instanceof Error ? error.message : String(error)}` }],
          isError: true
        };
      }
    }
    
    export async function handleSerieMetadados(
      args: { codigo: number },
      timeoutMs?: number,
  • The definition and input schema for the `bcb_serie_ultimos` tool.
    {
      name: "bcb_serie_ultimos",
      description: "Obtém os últimos N valores de uma série temporal do BCB. Útil para consultar dados mais recentes.",
      inputSchema: {
        type: "object" as const,
        properties: {
          codigo: { type: "number" as const, description: "Código da série no SGS/BCB" },
          quantidade: { type: "number" as const, description: "Quantidade de valores a retornar (1-1000, padrão: 10)" }
        },
        required: ["codigo"]
      }
    },
  • src/tools.ts:848-852 (registration)
    The `dispatchTool` function routes the `bcb_serie_ultimos` tool to its handler function.
    case "bcb_serie_ultimos":
      return handleSerieUltimos(
        { codigo: args.codigo as number, quantidade: (args.quantidade as number) || 10 },
        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 the full burden of behavioral disclosure. It mentions the tool is for querying recent data but doesn't cover important aspects like whether it's a read-only operation, potential rate limits, authentication requirements, error handling, or the format of returned values. For a data retrieval tool with no annotations, this leaves significant gaps in understanding its behavior and constraints.

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 very concise and well-structured: two short sentences that directly state the purpose and a usage hint. There's no wasted language, and it's front-loaded with the core functionality. Every sentence earns its place by adding value, making it efficient and easy to parse.

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

Completeness2/5

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

Given the complexity of a data retrieval tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., safety, performance), output format, error conditions, and how it differs from sibling tools. While concise, it doesn't provide enough context for an agent to fully understand how to use this tool effectively in isolation or relative to alternatives.

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?

The input schema has 100% description coverage, with clear documentation for both parameters ('codigo' and 'quantidade'), including constraints like min/max values and defaults. The description adds minimal semantic value beyond the schema—it implies 'últimos N valores' relates to the 'quantidade' parameter but doesn't provide additional context or examples. Given the high schema coverage, a baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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: 'Obtém os últimos N valores de uma série temporal do BCB' (Gets the last N values of a BCB time series). It specifies the verb ('obtém'), resource ('série temporal do BCB'), and scope ('últimos N valores'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'bcb_serie_valores' or 'bcb_indicadores_atuais', which might offer similar functionality.

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

Usage Guidelines3/5

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

The description includes a usage hint: 'Útil para consultar dados mais recentes' (Useful for querying the most recent data), which implies when to use this tool—for recent data queries. However, it doesn't provide explicit guidance on when not to use it or mention alternatives among the sibling tools (e.g., 'bcb_serie_valores' for broader date ranges). The guidance is implied but lacks specificity about exclusions or comparisons.

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