Skip to main content
Glama

get_bank_by_code

Retrieve detailed information about a specific Brazilian bank using its unique code, sourced from the Brasil API. Simplify banking data integration for applications and AI systems.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
codeYes

Input Schema (JSON Schema)

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

Implementation Reference

  • The async handler function that fetches specific bank information by code using the Brasil API client, formats the response as pretty JSON, and handles errors.
    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}`); } },
  • Zod schema defining the single required input parameter 'code' as a number.
    const GetBankByCodeToolParams = { code: z.number(), };
  • src/index.ts:30-41 (registration)
    The getBankByCodeTool is included in the array of tools and registered to the MCP server via registerTool in a loop.
    const tools = [ getCepTool, getCepV2Tool, getBookByISBNTool, getCNPJTool, getAllBanksTool, getBankByCodeTool, ]; tools.forEach((tool) => { registerTool(server, tool); });
  • Export of the McpToolDefinition for 'get_bank_by_code', including name, description, params schema reference, and handler function.
    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}`); } }, };

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

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