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,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states it 'Get[s] information' but doesn't clarify what type of information is returned, whether it's a read-only operation, if there are rate limits, authentication needs, or error conditions. This leaves significant gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence clearly states the tool's purpose, and the second sentence adds useful context about the parameter source. There is no wasted text, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (a lookup tool with no annotations, 1 parameter, 0% schema coverage, and no output schema), the description is incomplete. It doesn't explain what information is returned, potential errors, or behavioral traits, leaving the agent with insufficient context to use the tool effectively beyond basic parameter guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that the 'code' parameter corresponds to a bank code obtained from 'get_all_banks', which clarifies the parameter's purpose beyond the schema's type definition. However, it doesn't provide details like format, valid ranges, or examples, so it only partially compensates for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get information from a specific bank given its code.' It specifies the verb ('Get'), resource ('bank'), and key constraint ('given its code'). However, it doesn't explicitly differentiate from sibling tools like 'get_all_banks' beyond mentioning that tool as a source for codes, so it falls short of a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by referencing 'get_all_banks' as the source for bank codes, suggesting this tool should be used when you have a specific bank code from that sibling. However, it doesn't provide explicit guidance on when to use this versus alternatives (e.g., other bank-related tools if they existed) or any exclusions, so it's only implied rather than explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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