check_subscription
Verify your QuantToGo subscription status, check remaining trial days, and view account details using your API key.
Instructions
Check your QuantToGo subscription status, remaining trial days, and account details. Requires a valid API key from register_trial.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | Yes | Your API key from register_trial (starts with 'qtg_') |
Implementation Reference
- src/index.ts:472-519 (handler)Handler function for check_subscription tool. Calls getApiStatus API endpoint, validates the API key, handles error responses (401 unauthorized, other errors), and returns subscription status data including email, status, trial days remaining, and account details.
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), }, ], }; } - src/index.ts:466-471 (registration)Registration of check_subscription tool using server.tool() with tool name, description, and Zod schema defining apiKey parameter as a string with description.
server.tool( "check_subscription", "Check your QuantToGo subscription status, remaining trial days, and account details. Requires a valid API key from register_trial.", { apiKey: z.string().describe("Your API key from register_trial (starts with 'qtg_')"), }, - src/index.ts:470-470 (schema)Input schema definition for check_subscription tool using Zod: apiKey parameter as string with description 'Your API key from register_trial (starts with qtg_)'
apiKey: z.string().describe("Your API key from register_trial (starts with 'qtg_')"), - src/index.ts:11-19 (helper)callAPI helper function used by check_subscription to make HTTP POST requests to the QuantToGo API endpoints. Takes function name and body parameters, returns JSON response.
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(); }