Skip to main content
Glama
derikfernandes

BCB Payment Methods MCP Server

consultar_portadores_cartao

Query quarterly data on payment card holders from Brazil's Central Bank (BCB) to analyze cardholder statistics and trends.

Instructions

Consulta informações sobre portadores de cartões de pagamento por trimestre.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trimestreYesAno e trimestre no formato YYYYQ (exemplo: '20234')
topNoNúmero máximo de registros a retornar (padrão: 100)
filtroNoFiltro OData para refinar a consulta

Implementation Reference

  • MCP handler for the tool: extracts trimestre, top, filtro parameters and fetches data from BCB's PortadoresCartaoDA API endpoint, returning formatted JSON response.
    case "consultar_portadores_cartao": {
      const { trimestre, top = 100, filtro } = args as {
        trimestre: string;
        top?: number;
        filtro?: string;
      };
    
      const data = await fetchBCBData(`PortadoresCartaoDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, {
        formato: "json",
        top,
        filter: filtro,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the tool, specifying required 'trimestre' parameter and optional top and filtro.
      {
        name: "consultar_portadores_cartao",
        description: "Consulta informações sobre portadores de cartões de pagamento por trimestre.",
        inputSchema: {
          type: "object",
          properties: {
            trimestre: {
              type: "string",
              description: "Ano e trimestre no formato YYYYQ (exemplo: '20234')",
            },
            top: {
              type: "number",
              description: "Número máximo de registros a retornar (padrão: 100)",
            },
            filtro: {
              type: "string",
              description: "Filtro OData para refinar a consulta",
            },
          },
          required: ["trimestre"],
        },
      },
    ];
  • src/index.ts:263-267 (registration)
    Registers the list of tools (including consultar_portadores_cartao) for MCP listTools requests.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools,
      };
    });
  • Duplicate MCP handler implementation in the HTTP server module for the tool.
    case "consultar_portadores_cartao": {
      const { trimestre, top = 100, filtro } = args as {
        trimestre: string;
        top?: number;
        filtro?: string;
      };
    
      const data = await fetchBCBData(`PortadoresCartaoDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, {
        formato: "json",
        top,
        filter: filtro,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Helper function to fetch data from BCB Olinda API, used by all tool handlers including consultar_portadores_cartao.
    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

B3.2/5.0
Behavior2/5

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

No annotations are present, so the description carries the full burden. It merely repeats the read-style verb 'consulta' and the quarter filter, but does not disclose whether the operation is read-only, any required permissions, return behavior, or limitations. The behavioral information provided adds little beyond what the tool name and schema already imply.

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 a single, front-loaded sentence with no filler. It is short and to the point, though it omits some guidance; conciseness itself is effective.

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?

For a simple read-oriented tool, the schema covers all parameters and the description states the purpose. However, there is no output schema or sibling context, and the description does not indicate what the returned 'informações' contain, leaving some ambiguity. Overall it is minimally sufficient but not complete.

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%, and each parameter already has a description. The tool description adds no parameter details beyond the generic quarter scope, so the baseline of 3 applies.

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 uses an explicit verb ('consulta') and a concrete resource ('portadores de cartões de pagamento'), and the 'por trimestre' qualifier ties it to the required quarter parameter. It clearly distinguishes the tool from the sibling tools, which deal with taxes, terminals, payment methods, transactions, and merchants.

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?

There is no mention of when to use this tool versus its seven siblings, and no exclusions or alternative routing. The description only states the general purpose, leaving an agent to infer the selection from the resource name alone.

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