Skip to main content
Glama
pineforge-4pass

PineForge-Codegen

Fetch Binance OHLCV to a file

fetch_binance_ohlcv
Destructive

Fetch Binance OHLCV candles and write a backtest-ready CSV for PineForge backtests. Automatically paginates large requests, supports spot or USDT perpetual futures, and records instrument metadata.

Instructions

Fetch OHLCV candles from Binance public API and write a backtest-ready CSV (header: timestamp,open,high,low,close,volume; timestamp = open time in UNIX ms UTC). Supports spot and usdt_perp (USDT-margined perpetual futures). Requests larger than 1000 bars are paginated automatically. Also records the symbol's instrument in .instrument.json (lot size: TradingView's own reading from a measured table shipped with this server, Binance's LOT_SIZE.stepSize for a symbol TradingView does not list, TradingView's usual 0.001 for a listing newer than the table; tick size and currencies from Binance's public exchangeInfo), which backtest_pine and backtest_pine_grid pick up; the result's instrument shows what was recorded. The output path must live inside the MCP cwd unless PINEFORGE_ALLOW_ANYWHERE=1.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoTotal bars to fetch. Default 1000. Paginated above 1000.
marketNo'spot' (default) or 'usdt_perp'.
symbolYesBinance symbol, e.g. 'BTCUSDT'. Use binance_symbols to validate.
end_timeNoUNIX ms UTC. Defaults to now.
intervalYesKline interval. Spot supports 1s + 1m..1M; usdt_perp supports 1m..1M (no 1s).
start_timeNoUNIX ms UTC. If unset, derived from end_time/now and limit.
output_pathYesPath to write the CSV (will create parent dirs as needed).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.8.4

TDQS

A4.5/5.0
Behavior5/5

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

Annotations declare a destructive, non-idempotent write, and the description richly corroborates that: it writes a CSV, creates a side-car <output_path>.instrument.json, paginates requests above 1000 bars, and enforces that output must live inside the MCP cwd unless PINEFORGE_ALLOW_ANYWHERE=1. These are side-effect and constraint details the annotations cannot convey.

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?

It is dense and information-rich rather than padded, front-loading the core action and output format before the instrument-file and path details. The instrument.json sentence is long and parenthetical, which slightly hurts scanability, but every sentence carries real information.

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 carries the return burden and does note that the result's `instrument` field reports what was recorded. Combined with the CSV format and path constraints, it is nearly complete, though it could say more about error behavior on invalid symbols or ranges.

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 beyond the schema: the CSV header layout, timestamp = open time in UNIX ms UTC, pagination above 1000 bars, and the cwd constraint on output_path. It stops short of explaining how start_time and end_time interact beyond what the schema already says.

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 states a specific verb (fetch) and resource (OHLCV candles from Binance) and its output (a backtest-ready CSV), and it clearly distinguishes itself from siblings like binance_symbols (used to validate) and backtest_pine/backtest_pine_grid (which consume the recorded instrument). An agent can route to it without opening another schema.

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?

Usage context is clear: it feeds backtesting tools, and binance_symbols is named in the schema for symbol validation. It doesn't explicitly state when-not to use it or name alternatives to fetch data, so it falls just short of full routing guidance.

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