Skip to main content
Glama
grahammccain

Chart Library

search

Read-onlyIdempotent

Find similar historical chart patterns by query string, raw bar sequence, or cohort similarity. 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 readOnlyHint=true and idempotentHint=true, so the agent knows it's safe. The description adds valuable behavioral context: text mode is ~50ms, returns specific fields (cohort_id, n_matches, etc.), and explains chaining. 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 a header, bulleted modes, examples, return format, and args list. It is fairly comprehensive but not excessively long. Slightly verbose in areas, but each sentence adds value.

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 the tool's complexity (3 modes, 8 parameters, output exists), the description covers most aspects: purpose, modes, parameters, return structure, and chaining. It could detail output schema fields or error conditions, but it is sufficient for effective use.

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?

Schema coverage is 0%, but the description fully compensates by explaining each parameter: query format, symbol/date/timeframe, top_k, mode, bars structure, cross_timeframe. It provides examples for query and live_bars mode, making the parameters clear and actionable.

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 purpose as the entry point for finding similar historical patterns and returning a cohort_id. It distinguishes three modes with specific use cases and examples, differentiating it from sibling tools like analyze or cohort.

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?

The description provides explicit guidance on when to use each mode: text for cheap/fast string-based search, live_bars for raw bar sequences, and similar for cohort-level similarity. It includes examples and notes that the resulting cohort_id can be chained into other tools.

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