Skip to main content
Glama
derikfernandes

BCB Payment Methods MCP Server

consultar_estabelecimentos_credenciados

Query the number of establishments authorized to accept electronic payment methods per quarter using Brazil's Central Bank data. Filter and sort results by quarter and other parameters.

Instructions

Consulta quantidade de estabelecimentos credenciados para aceitar meios de pagamento eletrônico 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)
ordenar_porNoCampo para ordenação
filtroNoFiltro OData para refinar a consulta

Implementation Reference

  • Main handler for executing the 'consultar_estabelecimentos_credenciados' tool in the MCP CallToolRequestSchema handler. Extracts parameters, calls fetchBCBData on BCB API endpoint 'EstabCredTransDA', and returns JSON-formatted data.
    case "consultar_estabelecimentos_credenciados": {
      const { trimestre, top = 100, ordenar_por, filtro } = args as {
        trimestre: string;
        top?: number;
        ordenar_por?: string;
        filtro?: string;
      };
    
      const data = await fetchBCBData(`EstabCredTransDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, {
        formato: "json",
        top,
        orderby: ordenar_por,
        filter: filtro,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the 'consultar_estabelecimentos_credenciados' tool, defining parameters like trimestre (required), top, ordenar_por, and filtro.
    {
      name: "consultar_estabelecimentos_credenciados",
      description: "Consulta quantidade de estabelecimentos credenciados para aceitar meios de pagamento eletrônico 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)",
          },
          ordenar_por: {
            type: "string",
            description: "Campo para ordenação",
          },
          filtro: {
            type: "string",
            description: "Filtro OData para refinar a consulta",
          },
        },
        required: ["trimestre"],
      },
    },
  • Handler for 'consultar_estabelecimentos_credenciados' tool in the HTTP server's MCP createMCPServer CallToolRequestSchema switch. Identical logic to index.ts.
    case "consultar_estabelecimentos_credenciados": {
      const { trimestre, top = 100, ordenar_por, filtro } = args as {
        trimestre: string;
        top?: number;
        ordenar_por?: string;
        filtro?: string;
      };
    
      const data = await fetchBCBData(`EstabCredTransDA(trimestre=@trimestre)?@trimestre='${trimestre}'`, {
        formato: "json",
        top,
        orderby: ordenar_por,
        filter: filtro,
      });
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the tool in http-server.ts tools array, matching index.ts.
    name: "consultar_estabelecimentos_credenciados",
    description: "Consulta quantidade de estabelecimentos credenciados para aceitar meios de pagamento eletrônico 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)",
        },
        ordenar_por: {
          type: "string",
          description: "Campo para ordenação",
        },
        filtro: {
          type: "string",
          description: "Filtro OData para refinar a consulta",
        },
      },
      required: ["trimestre"],
    },
  • Helper function fetchBCBData used by the tool handler to query the BCB Olinda API, building URL with OData params and fetching JSON data.
    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.3/5.0
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 only states that the tool performs a consultation and does not clarify whether the result is an aggregated count or a paginated list, nor does it disclose pagination, filtering behavior, or other operational characteristics.

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 a single, front-loaded sentence with no filler or redundant wording. Every part of it contributes to identifying the tool's purpose.

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 query tool with fully documented parameters, this reaches the minimum viability threshold. However, with no output schema or annotations, the description should more clearly state whether the tool returns a single quantity or a list of records, and it does not.

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 is 3 even though the description adds no parameter-level detail. The phrase 'por trimestre' only reinforces the trimestre parameter and does not explain top, filtro, or ordenar_por beyond what the schema already provides.

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 names a specific resource ('estabelecimentos credenciados'), a specific action ('Consulta'), and the relevant time dimension ('por trimestre'). This clearly separates it from sibling tools focused on taxas, terminais, portadores, and transações.

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 says nothing about when to use this tool versus any of its siblings, and no alternative tools are referenced. The only implicit clue is 'por trimestre', which could help distinguish it from monthly tools, but that selection logic is never stated.

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