Skip to main content
Glama
derikfernandes

BCB Payment Methods MCP Server

consultar_meios_pagamento_mensal

Query monthly payment method data from Brazil's Central Bank, including PIX, bank slips, TED, DOC, and card transactions. Specify year-month to retrieve statistics for analysis.

Instructions

Consulta dados mensais sobre meios de pagamento, incluindo operações com boletos bancários, PIX, TED, DOC e outros. Use o formato YYYYMM para o parâmetro ano_mes (exemplo: '202312' para dezembro de 2023).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ano_mesYesAno e mês no formato YYYYMM (exemplo: '202312')
topNoNúmero máximo de registros a retornar (padrão: 100)
skipNoNúmero de registros a pular para paginação
filtroNoFiltro OData para refinar a consulta (exemplo: "Modalidade eq 'PIX'")

Implementation Reference

  • Core handler logic for executing the 'consultar_meios_pagamento_mensal' tool. Parses input arguments, calls fetchBCBData with the specific OData endpoint for monthly payment methods, and returns the JSON-formatted API response.
    case "consultar_meios_pagamento_mensal": {
      const { ano_mes, top = 100, skip, filtro } = args as {
        ano_mes: string;
        top?: number;
        skip?: number;
        filtro?: string;
      };
    
      const data = await fetchBCBData(`MeiosdePagamentosMensalDA(AnoMes=@AnoMes)?@AnoMes='${ano_mes}'`, {
        formato: "json",
        top,
        skip,
        filter: filtro,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the tool, specifying required 'ano_mes' parameter in YYYYMM format and optional pagination/filter parameters.
    {
      name: "consultar_meios_pagamento_mensal",
      description: "Consulta dados mensais sobre meios de pagamento, incluindo operações com boletos bancários, PIX, TED, DOC e outros. Use o formato YYYYMM para o parâmetro ano_mes (exemplo: '202312' para dezembro de 2023).",
      inputSchema: {
        type: "object",
        properties: {
          ano_mes: {
            type: "string",
            description: "Ano e mês no formato YYYYMM (exemplo: '202312')",
          },
          top: {
            type: "number",
            description: "Número máximo de registros a retornar (padrão: 100)",
          },
          skip: {
            type: "number",
            description: "Número de registros a pular para paginação",
          },
          filtro: {
            type: "string",
            description: "Filtro OData para refinar a consulta (exemplo: \"Modalidade eq 'PIX'\")",
          },
        },
        required: ["ano_mes"],
      },
  • MCP server handler for 'consultar_meios_pagamento_mensal' tool execution, identical logic to stdio version.
    case "consultar_meios_pagamento_mensal": {
      const { ano_mes, top = 100, skip, filtro } = args as {
        ano_mes: string;
        top?: number;
        skip?: number;
        filtro?: string;
      };
    
      const data = await fetchBCBData(`MeiosdePagamentosMensalDA(AnoMes=@AnoMes)?@AnoMes='${ano_mes}'`, {
        formato: "json",
        top,
        skip,
        filter: filtro,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the tool in HTTP server version, identical to stdio server.
    {
      name: "consultar_meios_pagamento_mensal",
      description: "Consulta dados mensais sobre meios de pagamento, incluindo operações com boletos bancários, PIX, TED, DOC e outros. Use o formato YYYYMM para o parâmetro ano_mes (exemplo: '202312' para dezembro de 2023).",
      inputSchema: {
        type: "object",
        properties: {
          ano_mes: {
            type: "string",
            description: "Ano e mês no formato YYYYMM (exemplo: '202312')",
          },
          top: {
            type: "number",
            description: "Número máximo de registros a retornar (padrão: 100)",
          },
          skip: {
            type: "number",
            description: "Número de registros a pular para paginação",
          },
          filtro: {
            type: "string",
            description: "Filtro OData para refinar a consulta (exemplo: \"Modalidade eq 'PIX'\")",
          },
        },
        required: ["ano_mes"],
      },
    },
  • Shared helper function to perform API requests to the BCB Olinda service, handling URL building, axios GET, and error wrapping. Used by all tool handlers.
    async function fetchBCBData(endpoint: string, params: QueryParams = {}) {
      try {
        const url = buildUrl(endpoint, params);
        const response = await axios.get(url, {
          headers: {
            "Accept": "application/json"
          }
        });
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new Error(`Erro ao consultar API do BCB: ${error.message}`);
        }
        throw error;
      }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. The verb 'Consulta' implies a read-only operation and the description discloses data scope plus the YYYYMM date constraint. But it says nothing about response shape, pagination limits, or other operational behavior that an agent would need to know when invoking it.

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?

Two sentences with zero waste: the first states purpose and scope with concrete payment-method examples, the second pins down the required date format with a worked example. Purpose is front-loaded.

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

Completeness4/5

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

For a query tool with 4 parameters and 1 required, the description plus fully-covered schema provide the essentials: what it does, its monthly scope, and the required parameter format. A brief note on the return shape would strengthen it, especially given the absence of an output schema, but nothing critical is missing for invoking it correctly.

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 baseline of 3 applies. The description's YYYYMM format guidance merely repeats what the schema already states for ano_mes and adds nothing new about top, skip, or filtro.

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?

Specific verb 'Consulta' (query) plus a clear resource: 'dados mensais sobre meios de pagamento', with explicit scope enumeration (boletos, PIX, TED, DOC). The 'mensal' qualifier inherently separates it from the 'trimestral' sibling, so an agent can tell them apart without opening either tool.

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?

The description establishes clear usage context by stating this tool covers monthly data, which implicitly contrasts with the quarterly payment-method sibling. However, it never explicitly names the alternative or states a when-not-to-use condition, leaving the routing to inference.

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