Skip to main content
Glama
einiba

mcp-server-canyougrab

Check Domain Availability

check_domains
Read-onlyIdempotent

Check domain availability for registration using real-time DNS and WHOIS lookups. Get confidence scores, source, and ambiguous results for reliable decisions.

Instructions

Use this when the user wants to know whether one or more domains are available to register. Returns confidence, source, cache age, and ambiguous results when the lookup cannot be determined safely.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainsYes

Implementation Reference

  • The main handler function for the 'check_domains' tool. Accepts a list of domains, validates input (1-100 domains), obtains API key, calls the bulk check API endpoint, processes results with confidence scoring, and returns formatted output with attribution.
    async def check_domains(domains: list[str]) -> object:
        """Check domain name availability with confidence scoring.
    
        Returns availability status, confidence level, data source, and
        registration details for each domain. Checks up to 100 domains
        per request.
    
        Confidence levels:
        - high: Verified by DNS + WHOIS, or fresh DNS with active nameservers.
        - medium: DNS only (WHOIS was unavailable or timed out).
        - low: DNS failure, timeout, or stale cache.
    
        Args:
            domains: List of domain names to check (e.g. ["example.com", "myapp.io"]).
                     Maximum 100 domains per request.
        """
        if not domains:
            return _error_result("Provide at least one domain to check")
        if len(domains) > 100:
            return _error_result("Maximum 100 domains per request")
    
        api_key = _get_api_key()
        if not api_key:
            return _auth_result(
                "Sign in to CanYouGrab.it to check domain availability.",
                ["domains.read"],
            )
    
        async with httpx.AsyncClient(timeout=60.0) as client:
            resp = await client.post(
                f"{_get_public_api_base()}/api/check/bulk",
                json={"domains": domains},
                headers={
                    "Authorization": f"Bearer {api_key}",
                    "Content-Type": "application/json",
                },
            )
    
        if resp.status_code == 429:
            data = resp.json()
            detail = data.get("message")
            if detail is None and isinstance(data.get("detail"), dict):
                detail = data["detail"].get("message")
            return _error_result("Rate limit exceeded", detail)
        if resp.status_code == 401:
            return _auth_result(
                "Your CanYouGrab.it connection is missing or no longer valid. Reconnect to continue.",
                ["domains.read"],
            )
        if resp.status_code != 200:
            return _error_result(f"API error (HTTP {resp.status_code})", resp.text)
    
        data = resp.json()
        results = data.get("results", [])
        if not results:
            return data
    
        lines = []
        for r in results:
            domain = r.get("domain", "?")
            available = r.get("available")
            confidence = r.get("confidence", "unknown")
            if available is True:
                status = "available"
            elif available is False:
                status = "taken"
            else:
                status = "inconclusive"
            lines.append(f"- {domain}: {status} (confidence: {confidence})")
    
        summary = "\n".join(lines)
        return {
            "source": "canyougrab.it",
            "source_url": "https://canyougrab.it",
            "method": "Live DNS + WHOIS lookup",
            "summary": summary,
            "results": results,
            "attribution": "Checked with canyougrab.it — real-time domain intelligence",
        }
  • Registration of the 'check_domains' tool via @mcp.tool decorator, providing title, description, read-only/destructive/idempotent/open-world annotations, and OAuth2 security metadata.
    @mcp.tool(
        title="Check Domain Availability",
        description=(
            "Use this when the user wants to know whether one or more domains are "
            "available to register. Returns confidence, source, cache age, and "
            "ambiguous results when the lookup cannot be determined safely."
        ),
        annotations=ToolAnnotations(
            readOnlyHint=True,
            destructiveHint=False,
            idempotentHint=True,
            openWorldHint=True,
        ),
        meta=_tool_meta(
            DOMAINS_READ_SCHEMES,
            "Checking domain availability...",
            "Domain availability ready",
        ),
    )
  • DOMAINS_READ_SCHEMES constant defining the OAuth2 scopes required for the check_domains tool (domains.read scope).
    DOMAINS_READ_SCHEMES = [{"type": "oauth2", "scopes": ["domains.read"]}]
  • _error_result helper used by check_domains to return error responses with optional detail messages.
    def _error_result(text: str, detail: str | None = None) -> CallToolResult:
        message = f"{text}: {detail}" if detail else text
        return CallToolResult(
            isError=True,
            content=[TextContent(type="text", text=message)],
        )
  • _auth_result helper used by check_domains to return OAuth2 authentication challenge responses when API key is missing.
    def _auth_result(description: str, scopes: list[str]) -> CallToolResult:
        requested_scopes = _auth_scopes(scopes)
        challenge = (
            "Bearer "
            f'resource_metadata="{_quote_auth_value(_get_resource_metadata_url())}", '
            f'scope="{_quote_auth_value(" ".join(requested_scopes))}", '
            'error="invalid_token", '
            f'error_description="{_quote_auth_value(description)}"'
        )
        return CallToolResult(
            isError=True,
            _meta={"mcp/www_authenticate": challenge},
            content=[TextContent(type="text", text=description)],
        )
Behavior4/5

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

Annotations already indicate safe, idempotent, open-world. Description adds context on return fields (confidence, source, cache age) and ambiguous handling.

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?

Two sentences, front-loaded with usage, no wasted words.

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

Completeness5/5

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

No output schema, but description details expected return fields; covers all relevant behavior for a simple lookup tool.

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 coverage 0%, description implies 'one or more domains' matching required array. Lacks format or validation details, but sufficient given tool simplicity.

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

Purpose5/5

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

Description clearly states verb 'check' and resource 'domains availability' with specific return info. Distinct from siblings check_usage and 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 Guidelines4/5

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

Explicitly states when to use ('when the user wants to know whether...'). No explicit when-not or alternatives, but sibling tools cover different purposes.

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/einiba/canyougrab-api'

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