Skip to main content
Glama
mauricio-cantu

brasil-api-mcp-server

get_postal_code_v2

Retrieve location data for Brazilian addresses using CEP postal codes. Query street names, neighborhoods, cities, and states to enhance applications with accurate Brazilian address information.

Instructions

Version 2 of get a location data given a CEP (postal code).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cepYesThe CEP to query

Implementation Reference

  • The handler function that implements the core logic of the tool: fetches postal code (CEP) data from Brasil API using the provided CEP and returns formatted text response or throws an error.
    handler: async ({ cep }): Promise<McpResponse> => {
      try {
        const result = await brasilApiClient.cep.getBy(cep);
        const content: McpTextContent = {
          type: "text",
          text: `CEP found:\n${prettifyJson(result.data)}`,
        };
        return {
          content: [content],
        };
      } catch (error: any) {
        console.error(error);
        throw new Error(`Failed to fetch cep ${cep}`);
      }
    },
  • Zod-based input schema defining the required 'cep' parameter as a string.
    const getCepV2ToolParams = {
      cep: z.string().describe("The CEP to query"),
    };
  • The tool definition object exported from the file, specifying name, description, params schema, and handler.
    export const getCepV2Tool: McpToolDefinition<GetCepV2ToolParams> = {
      name: "get_postal_code_v2",
      description: "Version 2 of get a location data given a CEP (postal code).",
      params: getCepV2ToolParams,
      handler: async ({ cep }): Promise<McpResponse> => {
        try {
          const result = await brasilApiClient.cep.getBy(cep);
          const content: McpTextContent = {
            type: "text",
            text: `CEP found:\n${prettifyJson(result.data)}`,
          };
          return {
            content: [content],
          };
        } catch (error: any) {
          console.error(error);
          throw new Error(`Failed to fetch cep ${cep}`);
        }
      },
    };
  • src/index.ts:30-41 (registration)
    The tool is imported and included in the central tools array, then registered to the MCP server.
    const tools = [
      getCepTool,
      getCepV2Tool,
      getBookByISBNTool,
      getCNPJTool,
      getAllBanksTool,
      getBankByCodeTool,
    ];
    
    tools.forEach((tool) => {
      registerTool(server, tool);
    });
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral context. It doesn't disclose whether this is a read-only operation, what authentication might be needed, rate limits, error conditions, or what format the location data returns. 'Version 2' implies some improvement but doesn't specify what behavioral changes exist from v1.

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

Conciseness4/5

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

The description is extremely concise - a single sentence that communicates the core purpose. However, it's arguably too concise given it's a v2 tool that should explain improvements over v1. Every word earns its place, but more context would be helpful.

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?

For a tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'location data' includes, how results differ from v1, error handling, or any behavioral characteristics. The agent has minimal guidance beyond the basic purpose.

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?

Schema description coverage is 100% with the single 'cep' parameter well-documented in the schema. The description adds no additional parameter semantics beyond what the schema already provides - it doesn't clarify CEP format requirements, validation rules, or examples. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose3/5

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

The description states the tool retrieves 'location data given a CEP (postal code)', which clarifies the verb (get) and resource (location data). However, it doesn't distinguish this from its sibling 'get_postal_code_v1' - it only mentions it's 'Version 2' without explaining what differentiates it from the previous version.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to use v2 over v1, what specific improvements v2 offers, or any prerequisites for usage. The agent must infer usage from the name alone.

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