get_screener_data
Fetch stock rows from a specific screener (e.g., golden-cross, hot-prospects) for its latest available data date.
Instructions
Return the current rows of a single stock screener for its latest data date. Use this when the user asks about a specific screener like 'hot prospects' or 'golden cross'. Common slugs: hot-prospects, golden-cross, death-cross, rsi-oversold, rsi-overbought, defensive-stocks, dividend-prospects, j-pattern, nearing-6-month-highs, week-52-high-top-picks, top-penny-pops, strong-volume-gains, top-tech-stocks, fundamentally-fine, income-and-growth, best-reits. If you don't know the slug, call list_screeners first. Returns { screener, pagination, data: [stock rows] }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | The screener slug, e.g. 'hot-prospects', 'golden-cross', 'rsi-oversold' | |
| page | No | Page number (1-based) | |
| limit | No | Rows per page (max 500) |
Implementation Reference
- src/tools/screeners.ts:54-65 (handler)Handler function that executes the get_screener_data tool logic. Parses input (slug, page, limit) via ScreenersInputSchema, builds a cache key, and calls the API endpoint /screeners/{slug} with pagination params.
export async function handleGetScreenerData( ctx: McpContext, rawArgs: unknown ): Promise<unknown> { const args = ScreenersInputSchema.parse(rawArgs); const page = args.page ?? 1; const limit = args.limit ?? 50; const key = `screeners:${args.slug}:${page}:${limit}`; return ctx.cache.wrap(key, 300_000, () => ctx.apiClient.get(`/screeners/${args.slug}`, { page, limit }) ); } - src/tools/screeners.ts:6-10 (schema)Zod schema for validating get_screener_data input. Defines required slug (string) and optional page (1-10000, default 1) and limit (1-500, default 50).
export const ScreenersInputSchema = z.object({ slug: z.string().min(1).describe("The screener slug, e.g. 'hot-prospects', 'golden-cross', 'rsi-oversold'"), page: z.number().int().min(1).max(10000).default(1).optional().describe("Page number (1-based)"), limit: z.number().int().min(1).max(500).default(50).optional().describe("Rows per page (max 500)"), }); - src/tools/index.ts:73-73 (registration)Registration mapping the tool name 'get_screener_data' to its handler function handleGetScreenerData in the HANDLERS record.
get_screener_data: (ctx, args) => handleGetScreenerData(ctx, args), - src/tools/index.ts:40-93 (helper)Registration function registerAllTools that sets up the server request handlers, dispatching CallToolRequestSchema to the HANDLERS record.
// ── Tool registry ────────────────────────────────────────────────────────── const PING_TOOL: Tool = { name: "ping", description: "Minimal sanity check. Returns { status, version, timestamp, cache_size }. No auth needed. Use this to verify the MCP server is reachable and responsive.", inputSchema: { type: "object", properties: {}, required: [] }, annotations: { ...READ_ONLY_ANNOTATIONS, openWorldHint: false }, }; const ALL_TOOLS: Tool[] = [ PING_TOOL, ...screenersTools, ...patternsTools, ...optionsFlowTools, ...stockTools, ...compositeTools, ...marketMomentumTools, ...trendsTools, ...educationTools, ]; type ToolHandler = (ctx: McpContext, args: unknown) => Promise<unknown>; const HANDLERS: Record<string, ToolHandler> = { ping: async (ctx) => ({ status: "ok", version: "1.0.0", timestamp: new Date().toISOString(), cache_size: ctx.cache.size(), }), list_screeners: (ctx) => handleListScreeners(ctx), get_screener_data: (ctx, args) => handleGetScreenerData(ctx, args), search_stocks_in_screeners: (ctx, args) => handleSearchStocksInScreeners(ctx, args), get_chart_patterns: (ctx, args) => handleGetChartPatterns(ctx, args), search_patterns: (ctx, args) => handleSearchPatterns(ctx, args), get_options_flow_overview: (ctx, args) => handleGetOptionsFlowOverview(ctx, args), get_options_flow_timeline: (ctx, args) => handleGetOptionsFlowTimeline(ctx, args), get_options_flow_signals: (ctx, args) => handleGetOptionsFlowSignals(ctx, args), get_unusual_options_activity: (ctx, args) => handleGetUnusualOptionsActivity(ctx, args), get_stock_info: (ctx, args) => handleGetStockInfo(ctx, args), get_candles: (ctx, args) => handleGetCandles(ctx, args), get_stock_report: (ctx, args) => handleGetStockReport(ctx, args), search_setups: (ctx, args) => handleSearchSetups(ctx, args), get_market_momentum: (ctx, args) => handleGetMarketMomentum(ctx, args), get_trends: (ctx, args) => handleGetTrends(ctx, args), get_trend_connections: (ctx, args) => handleGetTrendConnections(ctx, args), explain_concept: (ctx, args) => handleExplainConcept(ctx, args), }; // ── Registration ─────────────────────────────────────────────────────────── export function registerAllTools(server: Server, ctx: McpContext): void {