Skip to main content
Glama
timolein74

asterpay-mcp-server

check_token_tiers

Check token tiers to determine API discount levels based on ASTERPAY token holdings, enabling users to identify potential savings on API calls.

Instructions

View ASTERPAY token tier system — hold ASTERPAY tokens for API discounts up to 60% off. FREE.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for check_token_tiers tool - calls the AsterPay API endpoint /v1/token/tiers and formats the response
    async () => formatResponse(await callApi("GET", "/v1/token/tiers"))
  • Registration of check_token_tiers tool with MCP server - defines tool name, description, empty schema (no parameters), and handler
    server.tool(
      "check_token_tiers",
      "View ASTERPAY token tier system — hold ASTERPAY tokens for API discounts up to 60% off. FREE.",
      {},
      async () => formatResponse(await callApi("GET", "/v1/token/tiers"))
    );
  • Empty schema object indicating the tool takes no input parameters
    {},
  • Helper function that makes HTTP requests to the AsterPay API - handles GET/POST methods and 402 payment required responses
    async function callApi(
      method: "GET" | "POST",
      path: string,
      body?: Record<string, unknown>
    ): Promise<{ status: number; data: unknown; paymentRequired?: unknown }> {
      const url = `${API_BASE}${path}`;
      const headers: Record<string, string> = { "Content-Type": "application/json" };
    
      const res = await fetch(url, {
        method,
        headers,
        ...(body ? { body: JSON.stringify(body) } : {}),
      });
    
      const data = await res.json();
    
      if (res.status === 402) {
        return {
          status: 402,
          data: null,
          paymentRequired: data,
        };
      }
    
      return { status: res.status, data };
    }
  • Helper function that formats API responses for MCP tool output - handles both successful responses and payment-required (402) responses with formatted payment instructions
    function formatResponse(result: { status: number; data: unknown; paymentRequired?: unknown }): {
      content: Array<{ type: "text"; text: string }>;
    } {
      if (result.status === 402) {
        const pr = result.paymentRequired as Record<string, unknown>;
        const accepts = (pr?.accepts as Array<Record<string, unknown>>)?.[0];
        const amount = accepts?.amount
          ? `${(parseInt(accepts.amount as string) / 1e6).toFixed(6)} USDC`
          : "unknown";
        const network = (accepts?.network as string) || "unknown";
    
        return {
          content: [
            {
              type: "text",
              text: [
                "Payment required to access this endpoint.",
                "",
                `Amount: ${amount}`,
                `Network: ${network}`,
                `Asset: USDC`,
                `Pay to: ${(accepts?.payTo as string) || "unknown"}`,
                "",
                "To use this endpoint, send an x402 payment via @x402/fetch or the AsterPay SDK.",
                "Install: npm install @x402/fetch",
                "",
                "Example:",
                "```",
                'import { wrapFetch } from "@x402/fetch";',
                'const fetchWithPay = wrapFetch(fetch, wallet);',
                `const res = await fetchWithPay("${API_BASE}${(pr?.resource as Record<string, unknown>)?.url || ""}");`,
                "```",
                "",
                "Docs: https://x402-api-production-ba87.up.railway.app/docs",
                "Discovery: https://x402-api-production-ba87.up.railway.app/discovery/resources",
              ].join("\n"),
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(result.data, null, 2),
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool is 'FREE' which hints at no cost, but doesn't describe response format, data freshness, rate limits, authentication needs, or what specific information about tiers is returned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that convey core functionality and key benefit. It's front-loaded with the main purpose, though the second sentence could be integrated more smoothly.

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

Completeness2/5

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

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what information is returned about token tiers, how the data is structured, or provide examples of the tier system details that would help an agent understand the response.

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 tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description appropriately doesn't add parameter information beyond what the schema provides, maintaining a clean baseline.

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 what the tool does ('View ASTERPAY token tier system') with a specific verb and resource. It distinguishes from sibling 'check_wallet_tier' by focusing on token tiers rather than wallet tiers, though the differentiation could be more explicit.

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 like 'check_wallet_tier' or other sibling tools. The description mentions API discounts and being free, but these are features rather than usage instructions.

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/timolein74/asterpay-mcp-server'

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