Skip to main content
Glama
grahammccain

Chart Library

Search Historical Patterns

search
Read-onlyIdempotent

Find historical chart patterns similar to a given query or symbol-date-timeframe anchor. Returns a cohort ID for further analysis.

Instructions

Entry point: find similar historical patterns and return a cohort_id.

Three modes:
  - mode="text" (default): pattern search by query string or
    symbol+date+timeframe. Cheap, fast, ~50ms.
    Examples:
      search(query="NVDA 2024-08-05 1h")
      search(symbol="NVDA", date="2024-08-05", timeframe="1h")
  - mode="live_bars": find historical analogs of a raw bar sequence
    the agent constructed (not yet stored in our DB). Pass `bars`
    as a list of {open, high, low, close, volume, timestamp}.
  - mode="similar": find cohorts most similar to a given (symbol,
    date) anchor at the cohort level, not the chart-pattern level.
    Useful for "what other setups historically clustered with this
    one?"

Returns: {status, data: {cohort_id, anchor, n_matches, top_matches,
survivorship}, meta}. The cohort_id can be chained into `cohort`,
`analyze`, or `explain` to compose richer responses without re-running
kNN.

Args:
    query: 'SYMBOL YYYY-MM-DD [timeframe]' (alt to symbol+date)
    symbol, date, timeframe: anchor components (alt to query)
    top_k: cohort size (10-2000)
    mode: "text" | "live_bars" | "similar"
    bars: list of OHLCV dicts (mode="live_bars" only)
    cross_timeframe: search across timeframes (mode="live_bars" only)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNo
symbolNo
dateNo
timeframeNo
top_kNo
modeNotext
barsNo
cross_timeframeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior. The description adds context about speed/cost (~50ms for text mode) and return structure (status, data, meta), disclosing that the cohort_id can be chained into other tools. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear headings (Three modes, Returns, Args). It front-loads the core purpose and then details modes, return, and parameters. While comprehensive, it could be slightly streamlined (e.g., the examples could be more terse). Still, every sentence adds value.

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 the tool's complexity (8 parameters, 3 modes, chaining to other tools), the description covers all aspects: mode selection, parameter constraints (e.g., bars only for live_bars), return structure, and chaining behavior. The existence of an output schema (though not shown) is supplemented by the described return fields.

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

Parameters5/5

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

With 0% schema description coverage, the tool description fully compensates by explaining each parameter: query, symbol, date, timeframe, top_k, mode, bars, cross_timeframe. It provides examples and clarifies that query is an alternative to symbol+date+timeframe, and that bars are only for live_bars mode.

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's function: 'find similar historical patterns and return a cohort_id.' It distinguishes three modes (text, live_bars, similar) with specific use cases and examples, setting it apart from sibling tools like 'similar_cohorts' or 'explain'.

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 provides explicit guidance on when to use each mode, with examples and performance characteristics (~50ms for text mode). It suggests chaining to 'cohort', 'analyze', or 'explain' for richer responses, though it does not explicitly state when not to use this tool vs. alternatives.

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/grahammccain/chart-library-mcp'

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