Skip to main content
Glama
guilhermelirio

Brasil API MCP

ibge-states-list

Retrieve comprehensive data about all Brazilian states, including names, codes, and regional information, for integration with Brazilian public data services.

Instructions

List all Brazilian states with their information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'ibge-states-list' tool. Fetches Brazilian states data from BrasilAPI, formats it as a newline-separated list with sigla, name, and region, and returns as text content or formatted error.
    async () => {
      console.error("Listing all Brazilian states");
      
      const result = await getBrasilApiData(`/ibge/uf/v1`);
      
      if (!result.success) {
        return formatErrorResponse(`Error listing states: ${result.message}`);
      }
      
      // Format the response data
      const states = result.data;
      const formattedStates = states.map((state: any) => 
        `${state.sigla} - ${state.nome} (Region: ${state.regiao.nome})`
      ).join("\n");
      
      return {
        content: [{ 
          type: "text" as const, 
          text: `Brazilian States:\n${formattedStates}` 
        }]
      };
    }
  • Registers the 'ibge-states-list' tool on the MCP server. Defines the tool name, description, empty input schema (no parameters), and attaches the handler function.
    server.tool(
      "ibge-states-list",
      "List all Brazilian states with their information",
      {},
      async () => {
        console.error("Listing all Brazilian states");
        
        const result = await getBrasilApiData(`/ibge/uf/v1`);
        
        if (!result.success) {
          return formatErrorResponse(`Error listing states: ${result.message}`);
        }
        
        // Format the response data
        const states = result.data;
        const formattedStates = states.map((state: any) => 
          `${state.sigla} - ${state.nome} (Region: ${state.regiao.nome})`
        ).join("\n");
        
        return {
          content: [{ 
            type: "text" as const, 
            text: `Brazilian States:\n${formattedStates}` 
          }]
        };
      }
    );
  • Shared helper function that performs API requests to BrasilAPI. Called by the handler with endpoint '/ibge/uf/v1' to retrieve the states list data.
    export async function getBrasilApiData(endpoint: string, params: Record<string, any> = {}) {
      try {
        const url = `${BASE_URL}${endpoint}`;
        console.error(`Making request to: ${url}`);
        
        const response = await axios.get(url, { params });
        return { 
          data: response.data,
          success: true
        };
      } catch (error: any) {
        console.error(`Error in API request: ${error.message}`);
        
        // Handle API errors in a structured format
        if (error.response) {
          return {
            success: false,
            statusCode: error.response.status,
            message: error.response.data?.message || error.message,
            error: error.response.data
          };
        }
        
        return {
          success: false,
          message: error.message,
          error
        };
      }
  • Shared helper function to format error responses consistently. Used by the handler if API call fails.
    export function formatErrorResponse(message: string) {
      return {
        content: [{ 
          type: "text" as const, 
          text: message 
        }],
        isError: true
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It only states the tool lists states with information, but doesn't mention what information is included, whether it's paginated, if there are rate limits, or any authentication requirements. This leaves significant behavioral aspects unspecified.

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 a single, efficient sentence that communicates the core functionality without any unnecessary words. It's appropriately sized for a simple list operation and front-loads the essential information.

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

Completeness3/5

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

For a zero-parameter list tool with no output schema, the description is minimally adequate but lacks important context. It doesn't specify what 'information' includes, the format of the response, or how comprehensive the listing is. Without annotations or output schema, more detail would be helpful for the agent to understand what to expect.

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

Parameters4/5

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

The tool has zero parameters with 100% schema description coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, which aligns with the schema. A baseline of 4 is appropriate for zero-parameter tools that don't need parameter explanations.

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 action ('List') and resource ('Brazilian states with their information'), making the purpose immediately understandable. However, it doesn't differentiate from its sibling 'ibge-state-search', which could be used for similar state-related queries, so it doesn't reach the highest score.

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 like 'ibge-state-search' or 'ibge-municipalities-list'. It simply states what the tool does without context about appropriate use cases or limitations.

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/guilhermelirio/brasil-api-mcp'

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