Skip to main content
Glama
stockmarketscan

stockmarketscan/mcp-server

Official

get_screener_data

Read-onlyIdempotent

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

TableJSON Schema
NameRequiredDescriptionDefault
slugYesThe screener slug, e.g. 'hot-prospects', 'golden-cross', 'rsi-oversold'
pageNoPage number (1-based)
limitNoRows per page (max 500)

Implementation Reference

  • 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 })
      );
    }
  • 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)"),
    });
  • 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),
  • 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 {
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=true. The description adds context about 'latest data date' and return shape, but does not add significant new behavioral details beyond what annotations provide.

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?

The description is three sentences, each with a distinct purpose: purpose, usage context, and examples/fallback/return format. It is front-loaded and contains no superfluous text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with 3 parameters and no output schema, the description adequately covers purpose, usage, parameter examples, error handling (unknown slug), and return format. No gaps are evident.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with good parameter descriptions. The description adds value by listing many common slug examples, helping the agent understand valid inputs beyond the schema's example. This slightly exceeds the baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns current rows of a single stock screener for its latest data date, differentiating it from list_screeners and others. It provides specific examples of common slugs and explicitly says when to use it.

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

Usage Guidelines5/5

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

It gives explicit guidance: 'Use this when the user asks about a specific screener' and provides a fallback instruction to call list_screeners if the slug is unknown. This effectively directs the AI agent on tool selection.

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/stockmarketscan/mcp-server'

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