get_signals
Retrieve recent trading signals for a QuantToGo strategy to inform investment decisions. Provides timestamped buy/sell signals with instrument, price, and direction using your API key.
Instructions
Get recent trading signals for a QuantToGo strategy. Requires a valid API key from register_trial. Returns timestamped buy/sell signals with instrument, price, and direction. Trial users have full access to all strategies for 30 days.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | Yes | Your API key from register_trial (starts with 'qtg_') | |
| productId | Yes | Strategy product ID from list_strategies, e.g. 'PROD-E3X' | |
| limit | No | Number of recent signals to return (max 50) |
Implementation Reference
- src/index.ts:396-461 (handler)The async handler function that executes the get_signals tool logic. It calls the getSignalsAPI endpoint with apiKey, productId, and limit parameters, then handles various response codes (401, 403, errors) and returns the signals data as JSON.
async ({ apiKey, productId, limit }) => { const res = (await callAPI("getSignalsAPI", { apiKey, productId, limit })) as { code: number; message: string; data?: { productId: string; productName: string; signalCount: number; signals: Array<{ date: string; time: string; direction: string; symbol: string; price: number | null; source?: string; }>; subscription: { status: string; trialEnd: string | null; daysRemaining: number | null; }; }; }; 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 === 403) { return { content: [ { type: "text" as const, text: "Trial expired. Email admin@quanttogo.com to subscribe for continued signal access.", }, ], }; } if (res.code !== 0 || !res.data) { return { content: [ { type: "text" as const, text: res.message || "Failed to fetch signals.", }, ], }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2), }, ], }; } - src/index.ts:387-395 (schema)Zod schema defining the input parameters for get_signals: apiKey (required string from register_trial), productId (required string from list_strategies), and limit (optional number with default 20, max 50).
{ apiKey: z.string().describe("Your API key from register_trial (starts with 'qtg_')"), productId: z.string().describe("Strategy product ID from list_strategies, e.g. 'PROD-E3X'"), limit: z .number() .optional() .default(20) .describe("Number of recent signals to return (max 50)"), }, - src/index.ts:384-385 (registration)Tool registration using server.tool() that registers 'get_signals' with its description, schema, and handler function.
server.tool( "get_signals", - src/index.ts:11-19 (helper)The callAPI helper function that makes HTTP POST requests to the QuantToGo API endpoints. Used by the get_signals handler to call the getSignalsAPI 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(); } - src/index.ts:54-55 (registration)The registerTools function that contains all tool registrations including get_signals. This function is called during server initialization.
function registerTools(server: McpServer): void {