Skip to main content
Glama
jasonwu001t

marketlens-mcp

by jasonwu001t

Resample

analytics_resample
Read-onlyIdempotent

Resample a stored time series to a coarser timeframe locally in DuckDB. Aggregate bars with OHLCV rules or other values by last, first, mean, sum, min, or max into UTC-aligned buckets.

Instructions

Resample a stored time series to a coarser timeframe, computed locally in DuckDB. Bars: open = first, high = max, low = min, close = last, volume = sum, trade_count = sum (None if any bar lacks it), vwap = volume-weighted (None when the volume is 0); the target must be coarser than the bars and hold whole bars. Other series (quotes, trades, snapshots, portfolio history, query results): each value column aggregated with agg (last, first, mean, sum, min, max) per series and bucket; other columns come from the bucket's last row. Rows with a NaN or infinite value are skipped. Buckets are UTC-aligned (weeks start Monday 00:00 UTC; t = bucket start). The output has the input's model. Large outputs are stored and you get a result_id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aggNoAggregation of each value column for inputs that are not bars (bars use OHLCV rules).last
result_idYesA stored time series: bars, or quotes, trades, snapshots, portfolio history, ...
timeframeYesTarget bucket: Nmin, Nh, 1d, 1w (Monday 00:00 UTC), Nmo; coarser than the input's 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?

Annotations cover the safety profile (readOnly, idempotent, non-destructive), and the description goes well beyond them: exact OHLCV aggregation rules, per-series agg semantics, NaN/infinite row skipping, UTC bucket alignment, output model preservation, and result_id storage for large outputs. This is unusually rich behavioral disclosure.

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-loads the purpose and then packs only substantive behavioral detail. It is a dense single block rather than bulleted, which slightly hurts scanability, but essentially every clause earns its place.

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 still explains the return contract (output retains the input's model; large outputs are stored behind a result_id). Combined with the aggregation and alignment rules, an agent has enough to call it correctly, though the exact return shape for the stored case could be clearer.

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 baseline is 3, but the description adds real meaning: it explains that agg applies per value column for non-bar series while bars use fixed OHLCV rules, and that timeframe must be coarser and hold whole bars. It enriches the schema rather than merely restating it.

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 (resample) and resource (a stored time series) and adds the mechanism (computed locally in DuckDB). It is clearly distinguishable from siblings like analytics_align or analytics_returns, which do different transformations of series.

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?

Gives clear context: it enumerates the accepted input types (bars, quotes, trades, snapshots, portfolio history, query results) and a hard precondition that the target must be coarser than the bars and hold whole bars. It does not name alternative tools or state when not to use it, so it stops short of the top tier.

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