Skip to main content
Glama
mauricio-cantu

brasil-api-mcp-server

get_bank_by_code

Retrieve bank details using a bank code. Provide the numeric code to access information about a specific Brazilian financial institution.

Instructions

Get information from a specific bank given its code. The code from each bank is returned by get_all_banks tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes

Implementation Reference

  • Implements the core logic of the 'get_bank_by_code' tool: fetches bank details from Brasil API using the provided code, formats as JSON, and returns as text content. Handles errors by throwing descriptive messages.
    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}`); } },
  • Defines the input schema using Zod: requires a 'code' parameter as a number.
    const GetBankByCodeToolParams = { code: z.number(), };
  • src/index.ts:30-41 (registration)
    Includes getBankByCodeTool in the list of tools and registers all tools with the MCP server using registerTool.
    const tools = [ getCepTool, getCepV2Tool, getBookByISBNTool, getCNPJTool, getAllBanksTool, getBankByCodeTool, ]; tools.forEach((tool) => { registerTool(server, tool); });
  • src/index.ts:10-10 (registration)
    Imports the getBankByCodeTool from src/tools/banks.ts for registration.
    import { getAllBanksTool, getBankByCodeTool } from "./tools/banks.js";
  • Tool metadata including name, description, and reference to params schema.
    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,

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

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