Skip to main content
Glama
jasonwu001t

marketlens-mcp

by jasonwu001t

Rolling volatility

analytics_volatility
Read-onlyIdempotent

Computes rolling annualised volatility for each series in a stored price or returns result to quantify risk over a chosen window, using DuckDB locally.

Instructions

Rolling annualised volatility of each series in a stored result of prices (or of returns from analytics_returns), computed locally in DuckDB: vol_t = stddev_samp(returns over the last window rows) x sqrt(periods_per_year), reported at the window's last observation; rows before the window fills are omitted. return_kind log (default) or simple for prices. periods_per_year defaults from the bar timeframe (1d 252, 1w 52, 1mo 12, 1h 1638, Nmin 98280/N: US equity sessions) and is required otherwise (365 for daily crypto). Volatility is a fraction per year (0.2 = 20 %). Large outputs are stored and you get a result_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
windowNoReturns per rolling window (2-2520).
result_idYesA stored result of prices, or of returns from analytics_returns.
return_kindNoReturns computed from prices (ignored for a returns result, which keeps its kind).log
price_columnNoNumeric column of prices (or returns). Default: the model's first value column.
series_columnNoColumn naming each series. Default: the result's group column.
periods_per_yearNoAnnualisation factor. Default from the bar timeframe: 1d 252, 1w 52, 1mo 12, 1h 1638, Nmin 98280/N (US equity sessions); required otherwise (e.g. 365 for daily crypto).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so safety is covered. The description adds real behavioural value beyond that: local DuckDB computation, omission of rows before the window fills, the reporting point (window's last observation), the fraction-per-year unit convention, and that large outputs are persisted as a result_id.

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?

A single dense paragraph that front-loads the core computation and formula, then edge behaviour and units. It is information-rich, though the periods_per_year mapping and return_kind notes duplicate schema text and could be trimmed.

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?

With no output schema, the description supplies the missing return semantics: annualised fraction units, per-window reporting point, and result_id persistence for large outputs. Only minor gaps remain (no mention of error conditions or empty-series behaviour), so it is nearly complete for a read-only analytics tool.

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 description coverage is 100%, so the schema already documents window bounds, result_id format, return_kind enum, and column defaults; that sets a baseline of 3. The description adds marginal framing (window as rows of returns, return_kind ignored for returns results) but largely restates the periods_per_year mapping already present in the 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?

States a specific verb+resource (computes rolling annualised volatility per series over a stored result) and pins down the exact formula, scope, and input source. It also distinguishes itself from the sibling analytics_returns by clarifying it can consume that tool's output.

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 makes clear the tool operates on a stored result of prices, or on returns produced by analytics_returns, which routes the agent to the right upstream tool. It stops short of explicitly stating when to prefer this over sibling analytics like beta/correlation/drawdown, so it is clear context without exclusions.

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