Skip to main content
Glama
stockmarketscan

stockmarketscan/mcp-server

Official

search_patterns

Read-onlyIdempotent

Search across multiple screeners to find stocks with specific chart patterns like head and shoulders or cup and handle. Returns matches with pattern details.

Instructions

Find all stocks across one or more screeners that currently exhibit specific chart patterns. Much faster than calling get_chart_patterns in a loop. Use when the user asks 'which stocks have a cup and handle' or 'find me hot prospects with bullish reversal patterns'. Returns { screeners_queried, patterns_queried, interval, count, matches: [...] }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
screener_slugsYesScreener slugs to search within
pattern_idsNoPattern ids to filter by (e.g. 'head_shoulders', 'cup_handle'). Empty = all patterns.
intervalNoChart interval1d

Implementation Reference

  • Handler function for search_patterns tool. Parses input args (screener_slugs, pattern_ids, interval) and POSTs to the /patterns API endpoint.
    export async function handleSearchPatterns(
      ctx: McpContext,
      rawArgs: unknown
    ): Promise<unknown> {
      const args = SearchPatternsInputSchema.parse(rawArgs);
      const interval = args.interval ?? "1d";
      const patternIds = args.pattern_ids ?? [];
      return ctx.apiClient.post("/patterns", {
        screeners: args.screener_slugs,
        patterns: patternIds,
        interval,
      });
    }
  • Zod input schema for search_patterns tool defining screener_slugs (required array 1-24), pattern_ids (optional array defaulting to []), and interval (optional '1d' or '1wk', defaults to '1d').
    export const SearchPatternsInputSchema = z.object({
      screener_slugs: z
        .array(z.string())
        .min(1)
        .max(24)
        .describe("Screener slugs to search within"),
      pattern_ids: z
        .array(z.string())
        .default([])
        .optional()
        .describe("Pattern ids to filter by (e.g. 'head_shoulders', 'cup_handle'). Empty = all patterns."),
      interval: z.enum(["1d", "1wk"]).default("1d").optional().describe("Chart interval"),
    });
  • Tool definition registration: name 'search_patterns', description, inputSchema using z.toJSONSchema(SearchPatternsInputSchema), and READ_ONLY_ANNOTATIONS.
    {
      name: "search_patterns",
      description:
        "Find all stocks across one or more screeners that currently exhibit specific chart patterns. Much faster than calling get_chart_patterns in a loop. Use when the user asks 'which stocks have a cup and handle' or 'find me hot prospects with bullish reversal patterns'. Returns { screeners_queried, patterns_queried, interval, count, matches: [...] }.",
      inputSchema: z.toJSONSchema(SearchPatternsInputSchema) as Tool["inputSchema"],
      annotations: READ_ONLY_ANNOTATIONS,
    },
  • Handler mapping in the HANDLERS record connecting the 'search_patterns' string to the imported handleSearchPatterns function.
    search_patterns: (ctx, args) => handleSearchPatterns(ctx, args),
  • ALL_TOOLS array spreading patternsTools (which includes search_patterns tool definition) into the full tool list for ListToolsRequestSchema.
    ...patternsTools,
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, so the safety profile is clear. The description adds valuable behavioral context by stating the return structure ({ screeners_queried, patterns_queried, interval, count, matches: [...] }) and performance characteristic (much faster than a loop), which goes 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 only two sentences, with the first sentence clearly stating the purpose and the second giving usage examples and return format. Every sentence earns its place with no fluff. It is front-loaded and highly efficient.

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

Completeness4/5

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

Given no output schema, the description includes the return structure, which is helpful. The tool has 3 parameters all fully described in the schema. The description covers the main use case and distinguishes from a key sibling. It could be more complete by mentioning edge cases (e.g., no matches), but overall it is adequate.

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 coverage is 100%, meaning all three parameters already have descriptions. The description does not add significant new information about parameters beyond what the schema provides. It implies that pattern_ids empty means all patterns and interval defaults to '1d', but these are already in the schema. Thus, baseline 3 is appropriate.

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 with specific chart patterns across screeners, provides example user queries ('which stocks have a cup and handle'), and explicitly differentiates itself from get_chart_patterns by noting it's faster than a loop. This makes the purpose highly specific and distinguishable from siblings.

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?

The description gives explicit when-to-use context (e.g., 'when the user asks which stocks have a cup and handle') and suggests an alternative (get_chart_patterns) by saying it's faster than looping. It lacks explicit when-not-to-use or exclusion of other siblings, but the guidance is clear and sufficient.

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