Skip to main content
Glama

check_subscription

Retrieve your subscription status and remaining trial days with your API key.

Instructions

Check subscription status and remaining trial days. Requires API key from register_trial.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiKeyYesYour API key from register_trial (starts with 'qtg_')

Implementation Reference

  • The main handler for check_subscription: calls getApiStatus API, validates the API key, and returns subscription data including trial status, days remaining, email, max products, etc.
    server.tool(
      "check_subscription",
      "Check subscription status and remaining trial days. Requires API key from register_trial.",
      {
        apiKey: z.string().describe("Your API key from register_trial (starts with 'qtg_')"),
      },
      async ({ apiKey }) => {
        const res = (await callAPI("getApiStatus", { apiKey })) as {
          code: number;
          message: string;
          data?: {
            email: string | null;
            status: string;
            inviteCode: string | null;
            trialEnd: string | null;
            daysRemaining: number;
            maxProducts: number;
            registeredAt: string | null;
            message: string;
            upgradeContact?: string;
          };
        };
    
        if (res.code === 401) {
          return {
            content: [
              {
                type: "text" as const,
                text: "Invalid API key. Use register_trial with your email to get a valid key.",
              },
            ],
          };
        }
    
        if (res.code !== 0 || !res.data) {
          return {
            content: [
              {
                type: "text" as const,
                text: res.message || "Failed to check subscription.",
              },
            ],
          };
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(res.data, null, 2),
            },
          ],
        };
      }
    );
  • Input schema: requires apiKey (string starting with 'qtg_'). Response shape typed inline with fields: email, status, inviteCode, trialEnd, daysRemaining, maxProducts, registeredAt, message, upgradeContact.
    {
      apiKey: z.string().describe("Your API key from register_trial (starts with 'qtg_')"),
    },
    async ({ apiKey }) => {
      const res = (await callAPI("getApiStatus", { apiKey })) as {
        code: number;
        message: string;
        data?: {
          email: string | null;
          status: string;
          inviteCode: string | null;
          trialEnd: string | null;
          daysRemaining: number;
          maxProducts: number;
          registeredAt: string | null;
          message: string;
          upgradeContact?: string;
        };
      };
  • src/index.ts:453-507 (registration)
    Tool registered via server.tool() inside the registerTools() function (line 47) with the name 'check_subscription'.
    server.tool(
      "check_subscription",
      "Check subscription status and remaining trial days. Requires API key from register_trial.",
      {
        apiKey: z.string().describe("Your API key from register_trial (starts with 'qtg_')"),
      },
      async ({ apiKey }) => {
        const res = (await callAPI("getApiStatus", { apiKey })) as {
          code: number;
          message: string;
          data?: {
            email: string | null;
            status: string;
            inviteCode: string | null;
            trialEnd: string | null;
            daysRemaining: number;
            maxProducts: number;
            registeredAt: string | null;
            message: string;
            upgradeContact?: string;
          };
        };
    
        if (res.code === 401) {
          return {
            content: [
              {
                type: "text" as const,
                text: "Invalid API key. Use register_trial with your email to get a valid key.",
              },
            ],
          };
        }
    
        if (res.code !== 0 || !res.data) {
          return {
            content: [
              {
                type: "text" as const,
                text: res.message || "Failed to check subscription.",
              },
            ],
          };
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(res.data, null, 2),
            },
          ],
        };
      }
    );
  • Helper function callAPI used by check_subscription to call the backend endpoint 'getApiStatus'. Makes a POST request to the API_BASE.
    async function callAPI(fn: string, body: Record<string, unknown> = {}): Promise<unknown> {
      const resp = await fetch(`${API_BASE}/${fn}`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(body),
      });
      if (!resp.ok) throw new Error(`API ${fn} returned ${resp.status}`);
      return resp.json();
    }
  • Helper function validateApiKey also uses getApiStatus, providing reusable API key validation logic used by check_subscription.
    async function validateApiKey(apiKey: string): Promise<{ valid: boolean; message: string }> {
      const res = (await callAPI("getApiStatus", { apiKey })) as {
        code: number;
        message: string;
      };
      if (res.code === 401) return { valid: false, message: "Invalid API key. Use register_trial with your email to get a valid key." };
      if (res.code === 403) return { valid: false, message: "Trial expired. Email admin@quanttogo.com to subscribe." };
      if (res.code !== 0) return { valid: false, message: res.message || "API key validation failed." };
      return { valid: true, message: "ok" };
    }
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It reveals the tool checks status and remaining days and requires an API key, but does not disclose behavioral traits such as read-only nature, error handling, rate limits, or what happens with invalid keys.

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 with the purpose in the first sentence and a prerequisite in the second. No redundancy, efficient, and front-loaded.

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?

For a simple one-parameter read tool, the description is minimally adequate but lacks information about the return value or behavior (no output schema). The agent cannot infer what the response contains, which is a gap for a complete understanding.

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 is 100% and the schema already describes the 'apiKey' parameter with detailed format hints (starts with 'qtg_'). The tool description reiterates the prerequisite but adds no new meaning beyond the schema, warranting the baseline score.

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?

Description clearly states it checks subscription status and remaining trial days, providing a specific verb and resource. However, it does not differentiate from the sibling tool 'get_subscription_info', which may have overlapping functionality.

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

Usage Guidelines3/5

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

The description gives a clear prerequisite (requires API key from register_trial) but lacks guidance on when to use this tool versus alternatives or when not to use it. No explicit exclusions or comparisons are provided.

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/QuantToGo/quanttogo-mcp'

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