Skip to main content
Glama

search_domains

Search domain name availability and pricing across specified TLDs. Provide a domain name and optional TLD list to receive availability status and cost for each TLD.

Instructions

Search for available domain names. Returns availability and pricing for each TLD.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesDomain name to search for (e.g., 'myproject', 'coolstartup')
tldsNoComma-separated TLDs to check (e.g., 'com,io,xyz'). Defaults to com,net,org,io,xyz

Implementation Reference

  • Main handler for the search_domains tool. Calls GET /domains/search?query=...&tlds=... via the Bloomfilter client, maps results to formatted text (checkmark/cross icons with pricing), and returns MCP tool result.
    export async function searchDomains(
      client: BloomfilterClient,
      params: { query: string; tlds?: string },
    ): Promise<McpToolResult> {
      try {
        const { data } = await client.http.get<SearchResponse>("/domains/search", {
          params: { query: params.query, ...(params.tlds && { tlds: params.tlds }) },
        });
    
        if (!data.results || data.results.length === 0) {
          return {
            content: [{ type: "text", text: `No results found for "${params.query}".` }],
          };
        }
    
        const lines = data.results.map((r) => {
          if (!r.available) {
            return `  \u274c ${r.domain} \u2014 unavailable`;
          }
          const price = r.priceUsd
            ? `$${r.priceUsd}`
            : r.priceCents
              ? `$${(r.priceCents / 100).toFixed(2)}`
              : "price unavailable";
          const premium = r.premium ? " (premium)" : "";
          return `  \u2705 ${r.domain} \u2014 ${price}/yr${premium}`;
        });
    
        const text = `Domain search results for "${params.query}":\n\n${lines.join("\n")}`;
    
        return { content: [{ type: "text", text }] };
      } catch (error) {
        return formatToolError(error);
      }
    }
  • Imports types: BloomfilterClient from client.ts, formatToolError for error handling, McpToolResult and SearchResponse from types.ts.
    import type { BloomfilterClient } from "../client.js";
    import { formatToolError } from "../client.js";
    import type { McpToolResult, SearchResponse } from "../types.js";
  • SearchResultDomain and SearchResponse interfaces define the API response shape consumed by searchDomains.
    export interface SearchResultDomain {
      domain: string;
      available: boolean;
      premium: boolean;
      priceCents?: number;
      priceUsd?: string;
    }
    
    export interface SearchResponse {
      query: string;
      results: SearchResultDomain[];
    }
  • src/index.ts:78-92 (registration)
    Registration of search_domains tool on the MCP server with Zod schema for query (required string) and tlds (optional string). Delegates to searchDomains handler.
    // 1. search_domains
    server.tool(
      "search_domains",
      "Search for available domain names. Returns availability and pricing for each TLD.",
      {
        query: z.string().describe("Domain name to search for (e.g., 'myproject', 'coolstartup')"),
        tlds: z
          .string()
          .optional()
          .describe(
            "Comma-separated TLDs to check (e.g., 'com,io,xyz'). Defaults to com,net,org,io,xyz",
          ),
      },
      async (params) => searchDomains(client, params),
    );
  • formatToolError helper used by searchDomains to convert any error (axios, rate-limit, network, timeout) into a consistent MCP error result.
    export function formatToolError(error: unknown, apiUrl?: string): McpToolResult {
      if (axios.isAxiosError(error)) {
        // Rate limited
        if (error.response?.status === 429) {
          const data = error.response.data as Record<string, unknown> | undefined;
          const message = (data?.message as string) ?? "Too many requests";
          return {
            content: [{ type: "text", text: `Rate limited: ${message}. Please wait before retrying.` }],
            isError: true,
          };
        }
    
        // API error response
        if (error.response?.data) {
          const data = error.response.data as Record<string, unknown>;
          const status = error.response.status;
    
          // x402 payment responses — two cases:
          // 1. Initial 402 with accepts array (no x402 wrapper, or wrapper disabled)
          // 2. Retry 402 after x402 wrapper tried to pay but settlement failed
          if (status === 402) {
            if (data.accepts) {
              // Case 1: Initial 402 with payment requirements
              const accepts = data.accepts as Array<Record<string, unknown>>;
              const amount = accepts[0]?.price ?? accepts[0]?.amount;
              const description = (data.resource as Record<string, unknown> | undefined)?.description;
              const detail = description
                ? `${description} requires payment of ${amount} USDC`
                : `Payment of ${amount} USDC required`;
              return {
                content: [
                  {
                    type: "text",
                    text: `Payment required: ${detail}. Ensure your wallet has sufficient USDC balance.`,
                  },
                ],
                isError: true,
              };
            }
            // Case 2: Payment was attempted but failed (insufficient balance, settlement error, etc.)
            const serverMsg =
              (data.message as string) ?? (data.error as string) ?? (data.detail as string);
            const detail = serverMsg ?? "payment was attempted but could not be settled on-chain";
            return {
              content: [
                {
                  type: "text",
                  text: `Payment failed: ${detail}. Check that your wallet has sufficient USDC balance on Base.`,
                },
              ],
              isError: true,
            };
          }
    
          const code = (data.code as string) ?? `HTTP ${status}`;
          const message =
            (data.message as string) ??
            (data.error as string) ??
            (data.detail as string) ??
            error.response.statusText ??
            `Request failed with status ${status}`;
          return {
            content: [{ type: "text", text: `Error [${code}]: ${message}` }],
            isError: true,
          };
        }
    
        // Network/connection error
        if (error.code === "ECONNREFUSED" || error.code === "ENOTFOUND") {
          const url = apiUrl ?? error.config?.baseURL ?? "unknown";
          return {
            content: [
              {
                type: "text",
                text:
                  `Failed to connect to Bloomfilter API at ${url}. ` +
                  "Check that the API is running and BLOOMFILTER_API_URL is correct.",
              },
            ],
            isError: true,
          };
        }
    
        // Timeout
        if (error.code === "ECONNABORTED" || error.code === "ERR_CANCELED") {
          return {
            content: [
              {
                type: "text",
                text: "Request timed out. The Bloomfilter API may be slow or unreachable.",
              },
            ],
            isError: true,
          };
        }
    
        // Generic axios error
        return {
          content: [{ type: "text", text: `Request failed: ${error.message}` }],
          isError: true,
        };
      }
    
      // Non-axios error
      const message = error instanceof Error ? error.message : String(error);
      return {
        content: [{ type: "text", text: `Error: ${message}` }],
        isError: true,
      };
    }
Behavior2/5

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

With no annotations, the description carries full burden. It states that the tool returns availability and pricing, but does not disclose whether the check is real-time, if there are rate limits, or what happens when a domain is unavailable. Basic behavioral context is missing.

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 extremely concise with two sentences and no wasted words. It front-loads the verb and resource, making it easy to scan.

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?

Given the simplicity of the tool (2 params, no output schema), the description is minimally adequate. It explains the purpose and return value, but lacks details on output format or edge cases. Could be more complete.

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%, so the schema clearly documents both parameters. The description does not add additional meaning beyond what the schema provides, but it does reinforce the search intent. Baseline score of 3 is appropriate.

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 'Search for available domain names' with a specific verb and resource. It also mentions returning 'availability and pricing for each TLD', which adds value. However, it does not explicitly distinguish this tool from siblings like get_pricing or get_domain_info.

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?

No guidance is provided on when to use this tool versus alternatives such as register_domain or get_domain_info. The description does not mention any prerequisites or context for when the tool should or should not be invoked.

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/BloomFilter-Labs/mcp-server-bloomfilter'

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