Skip to main content
Glama
derikfernandes

BCB Payment Methods MCP Server

consultar_terminais_atm

Query ATM terminal statistics by quarter to analyze Brazil's Central Bank payment infrastructure data, with options to filter results and limit records.

Instructions

Consulta estatísticas sobre terminais de autoatendimento (ATM/caixas eletrônicos) 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

  • Handler for the 'consultar_terminais_atm' tool. Extracts parameters, calls fetchBCBData on the 'TerminaisATMDA' endpoint with the trimestre parameter, and returns the JSON data as text content.
    case "consultar_terminais_atm": {
      const { trimestre, top = 100, filtro } = args as {
        trimestre: string;
        top?: number;
        filtro?: string;
      };
    
      const data = await fetchBCBData(`TerminaisATMDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, {
        formato: "json",
        top,
        filter: filtro,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Tool definition including name, description, and input schema for 'consultar_terminais_atm'. Requires 'trimestre' (YYYYQ format), optional 'top' and 'filtro'.
    {
      name: "consultar_terminais_atm",
      description: "Consulta estatísticas sobre terminais de autoatendimento (ATM/caixas eletrônicos) 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"],
      },
    },
  • Shared helper function to make API requests to the BCB Olinda service, builds URL with OData params and fetches JSON data. Used by all tool handlers including consultar_terminais_atm.
    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;
      }
    }
  • Helper function to construct OData query URLs for BCB API endpoints, appending parameters like $top, $filter, etc. Used by fetchBCBData.
    function buildUrl(endpoint: string, params: QueryParams = {}): string {
      const url = new URL(`${API_BASE_URL}/${endpoint}`);
    
      if (params.formato) url.searchParams.append("$format", params.formato);
      if (params.top) url.searchParams.append("$top", params.top.toString());
      if (params.skip) url.searchParams.append("$skip", params.skip.toString());
      if (params.filter) url.searchParams.append("$filter", params.filter);
      if (params.orderby) url.searchParams.append("$orderby", params.orderby);
    
      return url.toString();
    }
  • src/index.ts:263-267 (registration)
    Registers the handler for ListToolsRequestSchema, which returns the tools array including 'consultar_terminais_atm'.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools,
      };
    });

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Como não há annotations, a descrição carrega a responsabilidade de indicar comportamento. Ela comunica que é uma operação de leitura/consulta e que os dados são agregados por trimestre, mas não descreve o formato do retorno, limites além do default de top, ou quaisquer restrições operacionais.

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?

A descrição é uma frase única, sem palavras desnecessárias, com o recurso principal e a dimensão temporal claramente front-loaded. O parêntese explicativo (ATM/caixas eletrônicos) agrega clareza sem inflar o texto.

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?

Para um tool simples de consulta, com todos os parâmetros documentados no schema, a descrição é suficiente para identificar o propósito. No entanto, não há output schema e a descrição não detalha quais estatísticas são retornadas, o que deixa uma lacuna perceptível para o agente saber exatamente o que esperar.

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?

A cobertura do schema é 100%, então os parâmetros já estão bem documentados. A descrição apenas ecoa 'por trimestre', que corresponde ao parâmetro obrigatório trimestre, sem adicionar significado novo sobre top, filtro ou formato exato de trimestre além do que o schema já informa.

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?

A descrição usa o verbo 'Consulta' e identifica um recurso específico ('terminais de autoatendimento (ATM/caixas eletrônicos)') com granularidade temporal ('por trimestre'), o que a distingue dos irmãos como consultar_taxas_intercambio e consultar_estabelecimentos_credenciados pelo assunto. Falta, porém, uma comparação explícita com outros tools ou a natureza exata das estatísticas retornadas.

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?

O caso de uso é implícito: o agente deve inferir que esta ferramenta é adequada quando a consulta envolve estatísticas de ATMs por trimestre. Não há orientação explícita sobre quando usar uma alternativa nem sobre exclusões ou pré-requisitos.

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