Skip to main content
Glama
stockmarketscan

stockmarketscan/mcp-server

Official

search_stocks_in_screeners

Read-onlyIdempotent

Identify high-confidence stock picks by finding stocks that appear in multiple screeners simultaneously. Supports intersection (stocks in all) and union (stocks in any) modes.

Instructions

Find stocks that appear in multiple screeners simultaneously. Powerful for high-confidence picks where the user wants confluence across strategies. Use when the user asks 'which stocks are in both X and Y' or 'find stocks in 3+ bullish screeners'. Returns { screeners_queried, mode, count, symbols: [{symbol, screeners, match_count}] }. Intersection mode returns only stocks in ALL listed screeners; union returns stocks in ANY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
screener_slugsYesList of screener slugs to query (1-24)
modeNointersection = stocks in ALL screeners; union = stocks in ANY screenerintersection
limitNo

Implementation Reference

  • Input schema (SearchStocksInScreenersInputSchema) defining parameters: screener_slugs (1-24 strings), mode (intersection/union), and limit.
    export const SearchStocksInScreenersInputSchema = z.object({
      screener_slugs: z
        .array(z.string())
        .min(1)
        .max(24)
        .describe("List of screener slugs to query (1-24)"),
      mode: z
        .enum(["intersection", "union"])
        .default("intersection")
        .optional()
        .describe("intersection = stocks in ALL screeners; union = stocks in ANY screener"),
      limit: z.number().int().min(1).max(500).default(50).optional(),
    });
  • Tool definition object with name 'search_stocks_in_screeners', description, and inputSchema.
    {
      name: "search_stocks_in_screeners",
      description:
        "Find stocks that appear in multiple screeners simultaneously. Powerful for high-confidence picks where the user wants confluence across strategies. Use when the user asks 'which stocks are in both X and Y' or 'find stocks in 3+ bullish screeners'. Returns { screeners_queried, mode, count, symbols: [{symbol, screeners, match_count}] }. Intersection mode returns only stocks in ALL listed screeners; union returns stocks in ANY.",
      inputSchema: z.toJSONSchema(SearchStocksInScreenersInputSchema) as Tool["inputSchema"],
      annotations: READ_ONLY_ANNOTATIONS,
    },
  • The handler function handleSearchStocksInScreeners: parses args, fetches each screener in parallel (cached, up to 500 rows), builds a symbol->screeners map, filters by intersection/union mode, sorts by match_count, and returns { screeners_queried, mode, count, symbols }.
    export async function handleSearchStocksInScreeners(
      ctx: McpContext,
      rawArgs: unknown
    ): Promise<unknown> {
      const args = SearchStocksInScreenersInputSchema.parse(rawArgs);
      const mode = args.mode ?? "intersection";
      const limit = args.limit ?? 50;
    
      // Fetch each screener in parallel with cached reads
      const results = await Promise.all(
        args.screener_slugs.map(async (slug) => {
          try {
            const res = await ctx.cache.wrap(
              `screeners:${slug}:1:500`,
              300_000,
              () =>
                ctx.apiClient.get<{ data?: { symbol?: string }[] }>(`/screeners/${slug}`, { limit: 500 })
            );
            const symbols = new Set(
              (res.data || [])
                .map((r) => (r.symbol || "").toUpperCase())
                .filter(Boolean)
            );
            return { slug, symbols };
          } catch {
            return { slug, symbols: new Set<string>() };
          }
        })
      );
    
      // Build symbol → screeners map
      const symbolMap = new Map<string, string[]>();
      for (const { slug, symbols } of results) {
        for (const sym of symbols) {
          if (!symbolMap.has(sym)) symbolMap.set(sym, []);
          symbolMap.get(sym)!.push(slug);
        }
      }
    
      const combined = Array.from(symbolMap.entries())
        .map(([symbol, screeners]) => ({
          symbol,
          screeners,
          match_count: screeners.length,
        }))
        .filter((row) => {
          if (mode === "intersection") return row.match_count === args.screener_slugs.length;
          return row.match_count >= 1;
        })
        .sort((a, b) => b.match_count - a.match_count || a.symbol.localeCompare(b.symbol))
        .slice(0, limit);
    
      return {
        screeners_queried: args.screener_slugs,
        mode,
        count: combined.length,
        symbols: combined,
      };
    }
  • Import of handleSearchStocksInScreeners from ./screeners.
      handleSearchStocksInScreeners,
    } from "./screeners";
  • Handler mapping in the HANDLERS record, routing 'search_stocks_in_screeners' to handleSearchStocksInScreeners.
    search_stocks_in_screeners: (ctx, args) => handleSearchStocksInScreeners(ctx, args),
Behavior4/5

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

Annotations already declare read-only, idempotent, and open-world. Description adds value by explaining the return structure and mode semantics, which are not covered by annotations. No mention of rate limits or auth, but annotations suffice for safety.

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?

Description is two sentences plus a return/mode explanation, all front-loaded with purpose. No redundant or vague phrasing. Every sentence earns its place.

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?

Given 3 params and no output schema, description explains return format, modes, usage hints, and even notes the slug limit (from schema). It is complete for a search tool with clear semantics, especially with sibling tools available for more detail.

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

Parameters3/5

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

Schema covers 2 of 3 parameters with descriptions (screener_slugs, mode). Description does not add per-parameter detail beyond schema; for 'limit' parameter, schema lacks description and description omits it. However, description explains overall behavior and return values, which aids parameter understanding.

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 finds stocks in multiple screeners, with specific use cases and modes (intersection/union). It distinguishes itself from sibling tools like get_screener_data by explicitly targeting confluence across strategies.

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

Usage Guidelines4/5

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

Description gives concrete query examples ('which stocks are in both X and Y') implying when to use. It does not explicitly say when not to use, but sibling tools context provides contrast. Overall clear guidance for the target use case.

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