Skip to main content
Glama
guilhermelirio

Brasil API MCP

registrobr-domain-check

Check .br domain availability and registration status to determine if a Brazilian domain name is ready for use or already taken.

Instructions

Check the status and availability of a .br domain name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain name to check (with or without .br extension)

Implementation Reference

  • The core handler function that processes the domain input, calls the BrasilAPI, and formats the markdown response with availability status, nameservers, expiry, and suggestions.
        async ({ domain }) => {
          console.error(`Checking domain status: ${domain}`);
          
          // Make sure we're using the domain name only without http or https
          let cleanDomain = domain.toLowerCase();
          cleanDomain = cleanDomain.replace(/^https?:\/\//i, "");
          cleanDomain = cleanDomain.replace(/^www\./i, "");
          
          // If domain doesn't end with .br, we don't add it automatically
          // as the API accepts any domain name to evaluate
    
          const result = await getBrasilApiData(`/registrobr/v1/${cleanDomain}`);
          
          if (!result.success) {
            return formatErrorResponse(`Error checking domain: ${result.message}`);
          }
          
          // Format the response data
          const domainInfo = result.data;
          
          // Create a formatted response based on the domain status
          let statusText;
          if (domainInfo.status === "AVAILABLE") {
            statusText = `${cleanDomain} is AVAILABLE for registration`;
          } else if (domainInfo.status === "REGISTERED") {
            statusText = `${cleanDomain} is REGISTERED`;
            
            // Add more details if available
            if (domainInfo.hosts && domainInfo.hosts.length > 0) {
              statusText += `\nNameservers: ${domainInfo.hosts.join(", ")}`;
            }
            
            if (domainInfo.expiresAt) {
              statusText += `\nExpires at: ${domainInfo.expiresAt}`;
            }
            
            if (domainInfo.suggestions && domainInfo.suggestions.length > 0) {
              statusText += `\n\nSimilar available domains:\n${domainInfo.suggestions.join("\n")}`;
            }
          } else {
            statusText = `Status for ${cleanDomain}: ${domainInfo.status}`;
            
            if (domainInfo.suggestions && domainInfo.suggestions.length > 0) {
              statusText += `\n\nSuggested available domains:\n${domainInfo.suggestions.join("\n")}`;
            }
          }
          
          return {
            content: [{ 
              type: "text" as const, 
              text: `
    Domain Check Result:
    ${statusText}
    ` 
            }]
          };
        }
      );
  • Zod input schema defining the 'domain' parameter for the tool.
    {
      domain: z.string()
        .describe("Domain name to check (with or without .br extension)")
    },
  • The registration function for the Registro.br tool, called from main index to add the tool to the MCP server.
    export function registerRegistroBrTools(server: McpServer) {
      // Tool to check domain availability and status in Registro.br
      server.tool(
        "registrobr-domain-check",
        "Check the status and availability of a .br domain name",
        {
          domain: z.string()
            .describe("Domain name to check (with or without .br extension)")
        },
        async ({ domain }) => {
          console.error(`Checking domain status: ${domain}`);
          
          // Make sure we're using the domain name only without http or https
          let cleanDomain = domain.toLowerCase();
          cleanDomain = cleanDomain.replace(/^https?:\/\//i, "");
          cleanDomain = cleanDomain.replace(/^www\./i, "");
          
          // If domain doesn't end with .br, we don't add it automatically
          // as the API accepts any domain name to evaluate
    
          const result = await getBrasilApiData(`/registrobr/v1/${cleanDomain}`);
          
          if (!result.success) {
            return formatErrorResponse(`Error checking domain: ${result.message}`);
          }
          
          // Format the response data
          const domainInfo = result.data;
          
          // Create a formatted response based on the domain status
          let statusText;
          if (domainInfo.status === "AVAILABLE") {
            statusText = `${cleanDomain} is AVAILABLE for registration`;
          } else if (domainInfo.status === "REGISTERED") {
            statusText = `${cleanDomain} is REGISTERED`;
            
            // Add more details if available
            if (domainInfo.hosts && domainInfo.hosts.length > 0) {
              statusText += `\nNameservers: ${domainInfo.hosts.join(", ")}`;
            }
            
            if (domainInfo.expiresAt) {
              statusText += `\nExpires at: ${domainInfo.expiresAt}`;
            }
            
            if (domainInfo.suggestions && domainInfo.suggestions.length > 0) {
              statusText += `\n\nSimilar available domains:\n${domainInfo.suggestions.join("\n")}`;
            }
          } else {
            statusText = `Status for ${cleanDomain}: ${domainInfo.status}`;
            
            if (domainInfo.suggestions && domainInfo.suggestions.length > 0) {
              statusText += `\n\nSuggested available domains:\n${domainInfo.suggestions.join("\n")}`;
            }
          }
          
          return {
            content: [{ 
              type: "text" as const, 
              text: `
    Domain Check Result:
    ${statusText}
    ` 
            }]
          };
        }
      );
    }
  • Utility function to make API requests to BrasilAPI, handling success and error responses. Used to fetch domain 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
        };
      }
    }
  • Utility function to format error messages into MCP-compatible responses. Used when API calls fail.
    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 full burden for behavioral disclosure. It mentions checking 'status and availability' but doesn't specify what status information is returned, whether it's a read-only operation, if there are rate limits, or what the output format looks like. This leaves significant gaps for a tool that presumably queries an external service.

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 gets straight to the point with zero wasted words. It's appropriately sized for a simple tool 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 single-parameter tool with good schema coverage but no annotations or output schema, the description provides basic purpose but lacks important context about what information is returned and behavioral characteristics. It's minimally adequate but has clear gaps in completeness.

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 100%, with the single parameter 'domain' well-documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline score when schema coverage is high.

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 verb ('Check') and resource ('status and availability of a .br domain name'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools, which are unrelated to domain checking, 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 or any contextual prerequisites. It simply states what the tool does without indicating appropriate usage scenarios.

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