Skip to main content
Glama
stockmarketscan

stockmarketscan/mcp-server

Official

get_chart_patterns

Read-onlyIdempotent

Return all chart patterns currently detected for a stock symbol, including head and shoulders, cup and handle, triangles, and harmonic patterns.

Instructions

Return all chart patterns currently detected for a single stock symbol. Covers 25+ patterns including head_shoulders, cup_handle, wedge_rising/falling, asc/desc/sym_triangle, double_top/bottom, channel_up/down, cup_handle, harmonic patterns (gartley, butterfly, bat, crab). Use when the user asks 'what patterns does X have' or 'is X forming a head and shoulders'. Returns { symbol, interval, computedAt, candleCount, patterns: [...] }. Empty patterns array if none detected.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock ticker, e.g. AAPL, TSLA, MSFT
intervalNoChart interval1d

Implementation Reference

  • The main handler function for get_chart_patterns. It parses the input schema, extracts symbol and interval, builds a cache key, and fetches chart patterns from the API client at /patterns/{symbol} with caching for 600 seconds.
    export async function handleGetChartPatterns(
      ctx: McpContext,
      rawArgs: unknown
    ): Promise<unknown> {
      const args = GetChartPatternsInputSchema.parse(rawArgs);
      const interval = args.interval ?? "1d";
      const key = `patterns:${args.symbol.toUpperCase()}:${interval}`;
      return ctx.cache.wrap(key, 600_000, () =>
        ctx.apiClient.get(`/patterns/${encodeURIComponent(args.symbol.toUpperCase())}`, {
          interval,
        })
      );
    }
  • Input schema for get_chart_patterns using Zod. Validates `symbol` (uppercase regex) and optional `interval` (1d or 1wk, default 1d).
    export const GetChartPatternsInputSchema = z.object({
      symbol: z
        .string()
        .regex(symbolRegex, "Invalid symbol — use uppercase like AAPL")
        .describe("Stock ticker, e.g. AAPL, TSLA, MSFT"),
      interval: z.enum(["1d", "1wk"]).default("1d").optional().describe("Chart interval"),
    });
  • Tool definition and registration in the patternsTools array. Defines name 'get_chart_patterns', description, inputSchema derived from GetChartPatternsInputSchema, and read-only annotations.
    export const patternsTools: Tool[] = [
      {
        name: "get_chart_patterns",
        description:
          "Return all chart patterns currently detected for a single stock symbol. Covers 25+ patterns including head_shoulders, cup_handle, wedge_rising/falling, asc/desc/sym_triangle, double_top/bottom, channel_up/down, cup_handle, harmonic patterns (gartley, butterfly, bat, crab). Use when the user asks 'what patterns does X have' or 'is X forming a head and shoulders'. Returns { symbol, interval, computedAt, candleCount, patterns: [...] }. Empty patterns array if none detected.",
        inputSchema: z.toJSONSchema(GetChartPatternsInputSchema) as Tool["inputSchema"],
        annotations: READ_ONLY_ANNOTATIONS,
      },
  • Handler registration in the HANDLERS record mapping the tool name 'get_chart_patterns' to its handler function handleGetChartPatterns.
    get_chart_patterns: (ctx, args) => handleGetChartPatterns(ctx, args),
    search_patterns: (ctx, args) => handleSearchPatterns(ctx, args),
  • Patterns tools are included in the ALL_TOOLS array via spread of patternsTools.
    ...screenersTools,
    ...patternsTools,
Behavior5/5

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

Annotations already indicate read-only, non-destructive, idempotent, and open-world behavior. The description adds value by detailing the return format (symbol, interval, computedAt, candleCount, patterns array) and confirming empty arrays when no patterns are found. No contradictions with annotations.

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 extremely concise, with two sentences plus a return-format note. It front-loads the purpose and provides all necessary information without unnecessary words. 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?

Despite lacking an explicit output schema, the description provides a complete picture: the tool's purpose, parameter usage (implied by examples), return structure, and behavioral semantics. It covers all aspects an agent needs to select and invoke the tool correctly.

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?

Input schema has 100% coverage with descriptions for both parameters. The description does not add new semantic information beyond the schema; it merely restates the symbol pattern and interval default. Per guidelines, high coverage justifies a 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 all chart patterns for a single stock symbol, lists specific patterns, and gives example user queries. It effectively distinguishes from siblings like search_patterns and search_setups by focusing on current detections for a single symbol.

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?

Includes explicit when-to-use examples (e.g., 'what patterns does X have'). It does not explicitly state when not to use or name alternatives, but the context of sibling tools implies alternatives like search_patterns for cross-symbol queries. The guidance is clear and actionable.

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