Skip to main content
Glama

bank-list

Retrieve a comprehensive list of Brazilian banks through the Brasil API MCP server, enabling access to banking institution data for integration and reference purposes.

Instructions

List all Brazilian banks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the bank-list tool. Fetches the list of Brazilian banks from BrasilAPI, formats as a list, handles errors, and returns text content.
    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}` }] }; }
  • Registers the 'bank-list' tool to the MCP server with description, empty input schema {}, and handler function.
    server.tool( "bank-list", "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}` }] }; } );
  • src/index.ts:27-27 (registration)
    Invokes registerBankTools to add bank tools (incl. bank-list) to the main MCP server instance.
    registerBankTools(server);
  • API client helper function used to fetch bank list data from BrasilAPI.
    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 responses consistently in MCP format.
    export function formatErrorResponse(message: string) { return { content: [{ type: "text" as const, text: message }], isError: true }; }

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