Skip to main content
Glama
xsf0221

Pattern Vista

Pattern Vista CLI

Command-line access to Pattern Vista — K-line pattern historical win-rates and MA200 deviation rankings — built to be called by AI agents as easily as by humans.

Output is JSON by default (so an agent can parse it directly); add --table for a human-readable view.

Install

pip install pattern-vista     # or: uvx pattern-vista whoami

Related MCP server: TickerAPI

Authenticate

Generate a key at https://www.pattern-vista.com (Account → API keys), then:

pv config set-key pv_live_xxxxxxxx
# or, for ephemeral/agent use:
export PATTERN_VISTA_API_KEY=pv_live_xxxxxxxx

Resolution order: --api-key flag → PATTERN_VISTA_API_KEY → stored config.

Commands

pv whoami                       # validate key, show account + tier
pv deviation --over --limit 20  # stocks furthest ABOVE their 200-day average
pv deviation --under            # stocks furthest BELOW (mean-reversion longs)
pv patterns --limit 20          # latest recommended patterns + 20-day win-rate
pv ticker AAPL                  # one symbol: current deviation + recent patterns
pv stretch --days 120           # market breadth: % of the universe above its MA200

# add --table to any command for human output:
pv deviation --under --table

Example (agent-friendly JSON)

$ pv deviation --under --limit 3
{
  "is_billed": true,
  "rows": [
    {"ticker": "XYZ", "snapshot_date": "2026-05-27", "close": 41.2, "ma200": 58.9, "deviation": -0.3005},
    ...
  ]
}

Free vs. paid

A free account sees the top 2 rows of each list and patterns without the historical win-rate. A paid subscription unlocks the full lists (up to 100) and hist_win_w20. The tier is enforced server-side from the key — see is_billed in every response.

For agents / programmatic use

from pattern_vista import PatternVistaClient

pv = PatternVistaClient(api_key="pv_live_xxxx")
under = pv.deviation("under", limit=20)   # dict: {"is_billed": ..., "rows": [...]}
aapl = pv.ticker("AAPL")

The PatternVistaClient core has no CLI dependency — it is what backs the MCP server below, so the two can never return different things.

Use as an MCP server

The same data as tools your agent can call directly. No install needed if you have uv:

{
  "mcpServers": {
    "pattern-vista": {
      "command": "uvx",
      "args": ["--from", "pattern-vista[mcp]", "pattern-vista-mcp"],
      "env": { "PATTERN_VISTA_API_KEY": "pv_live_xxxxxxxx" }
    }
  }
}

Drop that into your MCP client's config (Claude Desktop, Claude Code, Cursor, or anything else that speaks MCP over stdio). If you would rather install it:

pip install 'pattern-vista[mcp]'   # then use "command": "pattern-vista-mcp"

Or run it in a container. -i is required — the transport is stdio, so without an attached stdin the server has nothing to read and exits straight away:

docker build -t pattern-vista-mcp .
docker run -i --rm -e PATTERN_VISTA_API_KEY=pv_live_xxxxxxxx pattern-vista-mcp

Tools

Tool

Answers

market_stretch

Is the market broadly extended or depressed right now, and how does that rank against its own history?

deviation_ranking

Which symbols are furthest below (or above) their own 200-day average?

recommended_patterns

What did last night's scan flag, and has that pattern bucket historically beaten SPY?

ticker_report

Everything held on one symbol.

account_status

Which account is this key, and is it on a paid tier?

Auth resolves exactly as the CLI's does: PATTERN_VISTA_API_KEY, else the key saved by pv config set-key. Tiering stays server-side — a free key gets 2 rows and a null hist_win_w20, so check is_billed in the response before treating a short list as a quiet market.

Works with both generations of the MCP Python SDK (mcp 1.x's FastMCP and 2.x's MCPServer).

Data notes

  • Deviation = (close − MA200) / MA200, refreshed nightly over an S&P 500 + Nasdaq 100 + major-ETF universe. Split-distorted and implausible values are filtered out before ranking.

  • Market breadth (pv stretch, market_stretch) is the share of that same universe closing above its own MA200, one reading per trading day, with the history behind it. Free for every tier — it is the same number the public page at https://www.pattern-vista.com/market/stretch publishes.

  • Win-rate (hist_win_w20) is the historical 20-trading-day hit rate of a pattern type since 2025-01-01. See the methodology post at https://www.pattern-vista.com/posts/pattern-alpha-backtest.

  • Past performance does not guarantee future results. Not investment advice.

License

MIT

Available Tools

5 tools
account_statusA

Validate the configured API key and report which account it belongs to and whether it is on a paid tier.

Worth calling before presenting any list as complete: on a free key every ranking is truncated to 2 rows and pattern win-rates come back null, which is indistinguishable from a quiet market unless the tier is known.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations provided, the description carries the burden of behavioral disclosure. It explains that the tool validates the key, reports account identity and tier, and clarifies the downstream effects of a free tier. It does not explicitly mention side-effect freedom or failure behavior, but the read-only nature is strongly implied.

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 compact and front-loaded: the core purpose appears in the first sentence, followed by a valuable usage note. Every sentence adds information without redundancy.

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?

The tool is simple, has no parameters, and has an output schema. The description provides enough context about what it does and when to use it, making it complete for an agent to select and invoke correctly.

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

Parameters4/5

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

The input schema has zero parameters and 100% schema description coverage, so there is nothing for the description to add. The baseline for a no-parameter tool is appropriate here.

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 validates the configured API key and reports account ownership plus paid-tier status. This distinguishes it from the sibling ranking/report tools, which focus on market data rather than account state.

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?

It explicitly tells the agent when to call it: before presenting any list as complete, because free keys truncate rankings to 2 rows and produce null win-rates. This is actionable guidance that prevents misinterpretation of data.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

deviation_rankingA

Symbols furthest from their own 200-day moving average, ranked.

direction="under" lists the most depressed names (price far below its long-term average — the mean-reversion long candidates); direction="over" lists the most extended ones. Deviation is (close - MA200) / MA200, so -0.30 means the price is 30% below its own 200-day average.

Symbols whose 200-day window contains a single-day move above 25% are excluded: in practice that is an unadjusted stock split rather than a real move, and it would otherwise dominate the ranking.

Args: direction: "under" or "over". limit: Max rows, up to 100. Free accounts always receive 2 regardless — check is_billed in the response before reporting the list as complete.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo
directionNounder

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: it discloses the deviation formula, excludes split-like single-day moves with reasoning, and warns that free accounts always return 2 rows. This is genuinely useful behavioral context.

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 well-organized: summary, formula/exclusion rationale, then argument details. Every sentence adds value, including the split-exclusion explanation and the is_billed check.

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?

An output schema exists, so return-value details are not needed. The description covers invocation semantics, edge cases, and account-dependent behavior, making it complete enough for an agent to call the tool correctly.

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 description coverage is 0%, so the description must compensate, and it does. It explains the meaning of direction values, the deviation calculation, and the limit parameter's maximum and free-account behavior. Defaults are left to the schema, which is acceptable.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool ranks symbols by distance from their 200-day moving average and explains both direction modes. It does not explicitly differentiate itself from sibling tools such as market_stretch, so it stops short of a 5.

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?

It gives clear usage context: direction='under' is for depressed mean-reversion candidates, direction='over' is for extended names, and the limit/billing caveat is spelled out. It does not mention alternatives or explicit when-not-to-use conditions, but the context is strong.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

market_stretchA

How stretched the US market is: the share of tracked symbols closing above their own 200-day moving average, plus where that reading ranks against its own recorded history.

This is a breadth (participation) measure, not an index level: a cap-weighted index can sit above its 200-day average while most of its members sit below theirs. Use it to answer "is the market broadly extended or broadly depressed right now", never as a forecast.

Args: days: How many trading sessions of history to return, newest last. Capped at 1000 server-side. Use a small number if you only need the current reading.

Returns: current: the latest session — snapshot_date, total, above_ma200, pct_above (0..1), median, p10, p90. percentile: where current.pct_above ranks in the full stored history, 0..1, where 1.0 means the broadest participation on record. history: the daily series, oldest first.

ParametersJSON Schema
NameRequiredDescriptionDefault
daysNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden. It reveals the tool's conceptual behavior (breadth vs. index level), the server-side cap of 1000 days, the ordering of returned history, and what each returned component represents. This gives the agent a solid mental model beyond the bare field names.

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 front-loaded with a one-sentence definition, followed by a short clarifying paragraph and structured Args/Returns sections. Every sentence contributes either conceptual framing, usage guidance, or parameter/return semantics, with no filler.

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?

For a single-parameter read-only metric with an output schema, the description is complete. It covers what the metric means, how to interpret it, the history cap, ordering conventions, parameter advice, and the shape of the return payload. An agent has everything needed to invoke and interpret the result correctly.

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?

The schema provides zero description for the 'days' parameter, but the description fully compensates by explaining it in trading sessions, stating that results are newest last, noting the server-side cap, and advising a small value when only the current reading is needed. This adds real semantic value beyond the raw schema.

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 defines the tool with a precise, measurable resource: the share of tracked symbols closing above their 200-day moving average, plus how that reading ranks in its own history. It clearly distinguishes the metric from an index level, so an agent can tell exactly what this tool computes and how it differs from price-level measures.

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?

It explicitly states when to use the tool: 'Use it to answer "is the market broadly extended or broadly depressed right now"' and when not to: 'never as a forecast.' It also clarifies that it is a participation/breadth measure rather than an index-level measure, giving the agent enough context to avoid misapplication.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

ticker_reportA

Everything held on one symbol: its current distance from its own 200-day moving average, and the chart patterns most recently detected on it.

Args: symbol: A US ticker, e.g. "AAPL". Case-insensitive.

Returns: deviation: null when the symbol is outside the covered universe (S&P 500 / Nasdaq 100 / major US ETFs) or was filtered out of the latest snapshot — a null here means "not covered", not "no deviation". patterns: recent detections, newest first, with hist_win_w20 for paid keys.

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the burden of behavioral disclosure. It discloses the covered universe (S&P 500 / Nasdaq 100 / major US ETFs), the filtering possibility, the ordering of patterns (newest first), and the paid-key field (hist_win_w20). This goes well beyond a generic 'returns data' statement. It does not mention rate limits or auth, but for a read-only report tool the disclosed behaviors are substantial.

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 compact and front-loaded: the first sentence states the tool's purpose, then Args and Returns sections add necessary detail. Every sentence earns its place, and the null-meaning clarification is high-value. No fluff or repetition of the schema.

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?

For a single-parameter read tool with an output schema, the description is nearly complete. It explains the symbol format, the covered universe, null semantics, and result ordering. The only minor gap is that it doesn't describe the pattern objects' fields beyond hist_win_w20, but the output schema likely covers that. Overall, an agent can call this tool correctly with high confidence.

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

Parameters4/5

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

Schema coverage is 0%, so the description must compensate. It explains the symbol parameter's format ('A US ticker, e.g. "AAPL"'), case-insensitivity, and the universe constraint. It also explains the return fields' semantics (deviation null meaning, patterns ordering). This is strong compensation for a single-parameter tool, though it could add more detail on pattern fields.

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 opens with a clear, specific statement: 'Everything held on one symbol: its current distance from its own ​200-day moving average, and the chart patterns most recently detected on it.' This names the resource (one symbol) and the two concrete outputs, distinguishing it from sibling tools like deviation_ranking or market_stretch. It is not a tautology and gives an agent a precise sense of what the tool returns.

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 explains the symbol argument format and case-insensitivity, and clarifies the meaning of a null deviation ('not covered', not 'no deviation'). It does not explicitly state when to prefer this tool over siblings, but the scope ('Everything held on one symbol') implies it is the per-symbol detail tool versus ranking/overview siblings. Clear context, but no explicit exclusions or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv0.1.0
    • First observedaccount_status
    • First observeddeviation_ranking
    • First observedmarket_stretch
    • First observedrecommended_patterns
    • First observedticker_report

TDQS

A4.7/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a clearly distinct concern: market-wide breadth, ranked deviation screeners, flagged chart patterns, single-symbol detail, and account status. Even where two tools touch deviation or patterns, one is a ranking and the other is a per-symbol report, so misselection is unlikely.

Naming Consistency5/5

All five tool names follow the same noun-based or noun_phrase convention (market_stretch, deviation_ranking, recommended_patterns, ticker_report, account_status) with no mixing of styles. The pattern is predictable and readable.

Tool Count5/5

Five tools form a compact, well-scoped set for a market breadth and pattern-analysis server. Each tool earns its place without redundancy or bloat.

Completeness4/5

The surface covers market-wide breadth, two ranked screeners, a single-symbol report, and API-key introspection — coherent coverage for the stated domain. Minor gaps exist, such as no direct historical lookup for a specific symbol's deviation or pattern history beyond the latest snapshot, but agents can work around this.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Pre-reasoned Bitcoin and macro market briefings with trend signals, confidence scores, and regime classification. 17 briefings covering BTC, Fed balance sheet, M2, Treasury yields, and cross-asset correlations.
    5
    107
    5
    MIT
  • A
    license
    C
    quality
    B
    maintenance
    Historical stock pattern intelligence for AI agents. Search 24M pre-computed chart pattern embeddings across 15K stocks and 10 years. 19 tools: pattern similarity search, forward returns, regime analysis, anomaly detection, sector rotation, earnings reactions, correlation shifts, scenario analysis, and more. Returns what happened historically when charts looked like this — compliance-safe
    22
    20
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Exposes global market breadth, volume, RSI, volatility, and sentiment for 12 major equity indices (US + Asia) via 5 tools.
    -