Skip to main content
Glama

bank-list

Access a comprehensive list of Brazilian banks through the Brasil API MCP server, enabling retrieval of essential banking data for integration or analysis.

Instructions

List all Brazilian banks

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • Handler function that lists all Brazilian banks by fetching data from BrasilAPI, formatting as 'code - name (ISPB)' list, and returning as MCP text content response.
    const result = await getBrasilApiData(`/banks/v1`); if (!result.success) { return formatErrorResponse(`Error listing banks: ${result.message}`); } // Format the response data const banks = result.data; const formattedBanks = banks.map((bank: any) => `${bank.code} - ${bank.name} (${bank.ispb})` ).join("\n"); return { content: [{ type: "text" as const, text: `Banks in Brazil:\n${formattedBanks}` }] }; } ); }
  • MCP server tool registration for 'bank-list': provides description, empty input schema (no params), and references the handler function.
    "List all Brazilian banks", {}, async () => { console.error("Listing all banks"); const result = await getBrasilApiData(`/banks/v1`); if (!result.success) { return formatErrorResponse(`Error listing banks: ${result.message}`); } // Format the response data const banks = result.data; const formattedBanks = banks.map((bank: any) => `${bank.code} - ${bank.name} (${bank.ispb})` ).join("\n"); return { content: [{ type: "text" as const, text: `Banks in Brazil:\n${formattedBanks}` }] }; } ); }
  • Input schema for bank-list tool: empty object indicating no input parameters required.
    console.error("Listing all banks");
  • API client helper used by bank-list handler to fetch bank list from https://brasilapi.com.br/api/banks/v1 with error handling.
    export async function getBrasilApiData(endpoint: string, params: Record<string, any> = {}) { try { const url = `${BASE_URL}${endpoint}`; console.error(`Making request to: ${url}`); const response = await axios.get(url, { params }); return { data: response.data, success: true }; } catch (error: any) { console.error(`Error in API request: ${error.message}`); // Handle API errors in a structured format if (error.response) { return { success: false, statusCode: error.response.status, message: error.response.data?.message || error.message, error: error.response.data }; } return { success: false, message: error.message, error }; } }
  • Utility to format error messages into MCP-compatible error responses, used when API call fails in bank-list handler.
    export function formatErrorResponse(message: string) { return { content: [{ type: "text" as const, text: message }], isError: true }; }

Other Tools

Related 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/guilhermelirio/brasil-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server