Skip to main content
Glama
123Ergo

unphurl-mcp

purchase

Purchase credit packages for URL analysis. Obtain a Stripe checkout link to pay and activate credits.

Instructions

Purchase pipeline check credits. Returns a Stripe Checkout URL that the user must open in a browser to complete payment.

The AI cannot complete the payment. Tell the user to open the URL in their browser, complete the Stripe checkout, and then confirm they've paid. Credits are added to the account automatically once Stripe confirms payment.

After purchase, use get_balance to verify credits have been added.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageYesPackage to purchase: pkg_100 ($9, 100 credits), pkg_500 ($39, 500 credits), pkg_2000 ($99, 2000 credits), pkg_10000 ($399, 10000 credits)

Implementation Reference

  • The main tool handler for 'purchase'. Registers the tool with server.registerTool, defines input schema (package enum: pkg_100, pkg_500, pkg_2000, pkg_10000), validates auth, calls api.purchase(args.package), and returns the Stripe Checkout URL.
      // --- purchase ---
      server.registerTool(
        "purchase",
        {
          description: `Purchase pipeline check credits. Returns a Stripe Checkout URL that the user must open in a browser to complete payment.
    
    The AI cannot complete the payment. Tell the user to open the URL in their browser, complete the Stripe checkout, and then confirm they've paid. Credits are added to the account automatically once Stripe confirms payment.
    
    After purchase, use get_balance to verify credits have been added.`,
          inputSchema: {
            package: z
              .enum(["pkg_100", "pkg_500", "pkg_2000", "pkg_10000"])
              .describe(
                "Package to purchase: pkg_100 ($9, 100 credits), pkg_500 ($39, 500 credits), pkg_2000 ($99, 2000 credits), pkg_10000 ($399, 10000 credits)"
              ),
          },
        },
        async (args) => {
          if (!api.hasApiKey) return authError();
    
          try {
            const result = await api.purchase(args.package);
            return successResult({
              ...result,
              _note:
                "The user must open this URL in a browser to complete payment. Credits are added automatically after Stripe confirms payment.",
            });
          } catch (err) {
            if (err instanceof ApiRequestError) return apiErrorToResult(err);
            return errorResult(err instanceof Error ? err.message : "Unknown error");
          }
        }
      );
  • Input schema for the purchase tool. Uses Zod to define a 'package' parameter as an enum of four package IDs (pkg_100, pkg_500, pkg_2000, pkg_10000) with descriptions including prices and credit counts.
      // --- purchase ---
      server.registerTool(
        "purchase",
        {
          description: `Purchase pipeline check credits. Returns a Stripe Checkout URL that the user must open in a browser to complete payment.
    
    The AI cannot complete the payment. Tell the user to open the URL in their browser, complete the Stripe checkout, and then confirm they've paid. Credits are added to the account automatically once Stripe confirms payment.
    
    After purchase, use get_balance to verify credits have been added.`,
          inputSchema: {
            package: z
              .enum(["pkg_100", "pkg_500", "pkg_2000", "pkg_10000"])
              .describe(
                "Package to purchase: pkg_100 ($9, 100 credits), pkg_500 ($39, 500 credits), pkg_2000 ($99, 2000 credits), pkg_10000 ($399, 10000 credits)"
              ),
          },
  • The api.purchase() method in the UnphurlAPI class. Makes an HTTP POST request to /v1/purchase with the package ID in the request body and returns a PurchaseResponse containing the checkout_url.
    async purchase(packageId: string): Promise<PurchaseResponse> {
      return this.doRequest<PurchaseResponse>("POST", "/v1/purchase", {
        package: packageId,
      });
    }
  • TypeScript interface PurchaseResponse defining the return type: checkout_url (string) and package details (id, credits, price).
    export interface PurchaseResponse {
      checkout_url: string;
      package: {
        id: string;
        credits: number;
        price: string;
      };
    }
  • src/index.ts:38-38 (registration)
    Registration call: registerBillingTools(server, api) in the main server entry point which registers get_balance, get_pricing, and purchase tools.
    registerBillingTools(server, api); // get_balance, get_pricing, purchase
Behavior5/5

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

Discloses that the tool returns a URL (not direct credit addition), that payment requires user action, and that credits are added upon Stripe confirmation.

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?

Three sentences covering purpose, AI responsibility, and post-purchase action; no unnecessary 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?

Covers the complete flow: input, output, user action, and verification step, despite no output schema.

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?

Schema already fully describes the package enum with prices; description adds value by explaining the URL return and user action steps.

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?

Clearly states it purchases credits and returns a Stripe URL, distinguishing from sibling tools like get_balance and get_pricing.

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?

Explicitly instructs the AI to tell the user to open the URL and later confirm payment, and suggests using get_balance to verify.

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