Skip to main content
Glama
123Ergo

unphurl-mcp

get_balance

Check your credit balance to monitor remaining credits, total purchased, used, and lifetime free lookups. Credits are consumed only for unknown domains; known and cached domains are free.

Instructions

Check your pipeline check credit balance. Shows credits remaining, total purchased, total used, and lifetime free lookups count.

Credits are consumed only when unknown domains run through the full analysis pipeline. Known domains (Tranco Top 100K) and cached domains (previously analysed by any Unphurl customer) are always free.

If credits_remaining is 0, you can still check known and cached domains for free. To check unknown domains, purchase more credits using the "purchase" tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'get_balance' tool via server.registerTool(). Defines the tool name, description, input schema (empty), and the async handler that checks auth and calls api.balance().
      // --- get_balance ---
      server.registerTool(
        "get_balance",
        {
          description: `Check your pipeline check credit balance. Shows credits remaining, total purchased, total used, and lifetime free lookups count.
    
    Credits are consumed only when unknown domains run through the full analysis pipeline. Known domains (Tranco Top 100K) and cached domains (previously analysed by any Unphurl customer) are always free.
    
    If credits_remaining is 0, you can still check known and cached domains for free. To check unknown domains, purchase more credits using the "purchase" tool.`,
          inputSchema: {},
        },
        async () => {
          if (!api.hasApiKey) return authError();
    
          try {
            const result = await api.balance();
            return successResult(result);
          } catch (err) {
            if (err instanceof ApiRequestError) return apiErrorToResult(err);
            return errorResult(err instanceof Error ? err.message : "Unknown error");
          }
        }
      );
  • The handler function for get_balance. Checks if API key is present (else returns authError), calls api.balance(), and returns the result wrapped in successResult. Catches ApiRequestError and generic errors.
      async () => {
        if (!api.hasApiKey) return authError();
    
        try {
          const result = await api.balance();
          return successResult(result);
        } catch (err) {
          if (err instanceof ApiRequestError) return apiErrorToResult(err);
          return errorResult(err instanceof Error ? err.message : "Unknown error");
        }
      }
    );
  • successResult helper — wraps data into the standard MCP CallToolResult format (JSON-stringified text content).
    export function successResult(data: unknown): CallToolResult {
      return {
        content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
      };
    }
  • authError helper — returns a standardized MCP error result when no API key is configured.
    export function authError(): CallToolResult {
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              error: "auth_required",
              message:
                "API key is missing. Set UNPHURL_API_KEY in your MCP server configuration, or use the signup tool to create an account first.",
            }),
          },
        ],
        isError: true,
      };
    }
  • BalanceResponse type definition — the shape of the data returned by the balance API endpoint: credits_remaining, total_purchased, total_used, free_lookups.
    export interface BalanceResponse {
      credits_remaining: number;
      total_purchased: number;
      total_used: number;
      free_lookups: number;
    }
Behavior4/5

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

The description explains credit consumption conditions (only for unknown domains) and free cases (known/cached domains). It also mentions lifetime free lookups count. With no annotations, this provides adequate behavioral context.

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 concise, well-structured with front-loaded main purpose. Every sentence adds value without redundancy.

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?

For a simple tool with no parameters and no output schema, the description covers all relevant aspects: what data is returned, when credits are consumed, and ties to the 'purchase' tool for further action. It feels complete.

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 input schema has zero parameters, so the description does not need to add parameter information. The baseline score for no-parameter tools is 4.

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?

The description clearly states that the tool checks the pipeline check credit balance and lists the specific data shown (credits remaining, total purchased, etc.). It distinguishes itself from sibling tools by explicitly mentioning the 'purchase' tool for buying credits.

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

Usage Guidelines5/5

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

The description tells when to use the tool (to check balance) and when not (if credits_remaining is 0, known/cached domains are still free). It also directs to the 'purchase' tool for unknown domains, providing clear guidance on alternatives.

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/123Ergo/unphurl-mcp'

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