register_trial
Start a free 30-day trial by providing your email. Receive an API key instantly or access your existing account if already registered.
Instructions
Start a free 30-day trial. Provide your email, get an API key instantly. Calling again with the same email returns your existing account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | Your email address for registration and credential recovery |
Implementation Reference
- src/index.ts:311-367 (registration)The 'register_trial' tool is registered using server.tool() with email input validation via Zod. It calls the 'registerTrial' API endpoint and returns API key, invite code, status, trial end date, and next steps.
// ── Tool: register_trial ───────────────────────────────────── server.tool( "register_trial", "Start a free 30-day trial. Provide your email, get an API key instantly. Calling again with the same email returns your existing account.", { email: z.string().email().describe("Your email address for registration and credential recovery"), }, async ({ email }) => { const res = (await callAPI("registerTrial", { email, source: "mcp" })) as { code: number; message: string; data?: { apiKey: string; inviteCode: string; status: string; trialEnd: string; alreadyRegistered: boolean; }; }; if (res.code !== 0 || !res.data) { return { content: [ { type: "text" as const, text: res.message || "Registration failed. Please try again or contact admin@quanttogo.com.", }, ], }; } const d = res.data; const result = { apiKey: d.apiKey, inviteCode: d.inviteCode, status: d.status, trialEnd: d.trialEnd, alreadyRegistered: d.alreadyRegistered, nextSteps: { getSignals: `Call get_signals with apiKey="${d.apiKey}" and a productId from list_strategies`, checkStatus: `Call check_subscription with apiKey="${d.apiKey}" to check your trial status`, webLogin: `Use invite code ${d.inviteCode} at https://www.quanttogo.com`, }, important: "Save your API key — you'll need it for future sessions.", }; return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2), }, ], }; } ); - src/index.ts:319-367 (handler)The async handler for register_trial: calls registerTrial API with email and source='mcp', processes the response, and returns structured result with apiKey, inviteCode, status, trialEnd, and nextSteps.
async ({ email }) => { const res = (await callAPI("registerTrial", { email, source: "mcp" })) as { code: number; message: string; data?: { apiKey: string; inviteCode: string; status: string; trialEnd: string; alreadyRegistered: boolean; }; }; if (res.code !== 0 || !res.data) { return { content: [ { type: "text" as const, text: res.message || "Registration failed. Please try again or contact admin@quanttogo.com.", }, ], }; } const d = res.data; const result = { apiKey: d.apiKey, inviteCode: d.inviteCode, status: d.status, trialEnd: d.trialEnd, alreadyRegistered: d.alreadyRegistered, nextSteps: { getSignals: `Call get_signals with apiKey="${d.apiKey}" and a productId from list_strategies`, checkStatus: `Call check_subscription with apiKey="${d.apiKey}" to check your trial status`, webLogin: `Use invite code ${d.inviteCode} at https://www.quanttogo.com`, }, important: "Save your API key — you'll need it for future sessions.", }; return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2), }, ], }; } ); - src/index.ts:316-318 (schema)Zod schema for register_trial input: expects an 'email' field validated as a string email.
{ email: z.string().email().describe("Your email address for registration and credential recovery"), }, - src/index.ts:11-19 (helper)The callAPI helper function used by register_trial handler to POST to the quanttogo.com API endpoint.
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(); }