Skip to main content
Glama
jasonwu001t

marketlens-mcp

by jasonwu001t

Returns

analytics_returns
Read-onlyIdempotent

Compute simple or log returns for each series in a stored market data result, optionally sampled by UTC period, using DuckDB and saving large outputs for further analysis.

Instructions

Simple or log returns of each series in a stored result (pass its result_id), computed locally in DuckDB. Per series ordered by time: simple r_t = p_t / p_t-1 - 1, log r_t = ln(p_t / p_t-1); the first row of each series has no return; NULL, NaN, infinite and non-positive prices are skipped and counted in the notes. With period (e.g. 1d, 1w), each series is first sampled to its last price per UTC bucket and t is the bucket start. Returns are fractions (0.01 = 1 %). Use split-adjusted bars (adjustment=all). Large outputs are stored and you get a result_id for results_query or other analytics_* tools.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindNosimple: p_t / p_t-1 - 1; log: ln(p_t / p_t-1).simple
periodNoSample each series to the last price per UTC bucket first (1d, 1w, 1mo, 1h, 5min, ...); default: returns between consecutive rows.
result_idYesA stored result of prices (bars, trades, snapshots, portfolio history, ...).
price_columnNoNumeric column of prices. Default: the model's first value column (close for bars).
series_columnNoColumn naming each series. Default: the result's group column.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: first row has no return, NULL/NaN/infinite/non-positive prices are skipped and counted in notes, period sampling takes the last price per UTC bucket with t as bucket start, returns are fractions, and large outputs are persisted with a returned result_id. This is rich behavioral context an agent can't get from the structured fields.

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?

Front-loaded with the core purpose, then formulas, edge cases, and output routing in a tight paragraph. Dense but nearly every clause carries semantic weight; slightly over-long for a single block of prose.

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 compensates by explaining the return format (fractions) and the result_id handoff to results_query. It covers the essential behavior for a computation tool, though it doesn't sketch the shape of the returned result beyond the id.

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 100%, so the baseline is 3, but the description adds meaning: it clarifies the precise effect of period (last price per UTC bucket, t = bucket start) and the default resolution behavior, and confirms price_column defaults to close for bars. It adds real value over the schema without being exhaustive.

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?

Names a specific verb and resource — computes simple or log returns of each series in a stored result identified by result_id. This is unambiguous and distinguishable from analytics_resample, analytics_volatility, and results_query (which it explicitly routes to for 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?

Tells the agent the required entry point (pass a result_id) and recommends split-adjusted bars (adjustment=all), plus where outputs go (results_query or other analytics_* tools). It lacks explicit when-not-to-use guidance or a named alternative for the same job, so it falls short of a 5.

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