Skip to main content
Glama
banks.ts1.49 kB
import { z } from "zod"; import { brasilApiClient } from "../apiClient/brasilApiClient.js"; import { McpTextContent, McpToolDefinition } from "../types/MCP.js"; import { prettifyJson } from "../utils/index.js"; export const getAllBanksTool: McpToolDefinition = { name: "get_all_banks", description: "Get information of all banks from Brazil.", params: {}, handler: async () => { try { const result = await brasilApiClient.bank.getAll(); const content: McpTextContent = { type: "text", text: prettifyJson(result.data), }; return { content: [content], }; } catch (error: any) { console.error(error); throw new Error(`Failed to fetch banks`); } }, }; const GetBankByCodeToolParams = { code: z.number(), }; export const getBankByCodeTool: McpToolDefinition< typeof GetBankByCodeToolParams > = { name: "get_bank_by_code", description: "Get information from a specific bank given its code. The code from each bank is returned by get_all_banks tool.", params: GetBankByCodeToolParams, handler: async ({ code }) => { try { const result = await brasilApiClient.bank.getBy(code); const content: McpTextContent = { type: "text", text: prettifyJson(result.data), }; return { content: [content], }; } catch (error: any) { console.error(error); throw new Error(`Failed to fetch bank with code ${code}`); } }, };

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/mauricio-cantu/brasil-api-mcp-server'

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