-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Context Management
These tools can return large payloads. An agent working a long task needs to keep its context window lean, or it burns tokens and slows down. This page is the discipline that keeps responses small. Most of it is baked into the project's CLAUDE.md so agents follow it automatically.
-
Always use
summary: trueondata_get_ohlcvunless you specifically need individual bars. -
Always use
study_filteron the Pine graphics tools when you know which indicator you want — don't scan every study. -
Never use
verbose: trueon Pine tools unless the user explicitly asks for raw drawing data (IDs, colors, coordinates). -
Avoid
pine_get_sourceon complex scripts — it can return 200KB+. Only read it if you need to edit the code. -
Avoid
data_get_indicatoron protected/encrypted indicators — their inputs are encoded blobs. Usedata_get_study_valuesfor current values instead. -
Prefer
capture_screenshotfor visual context over pulling large datasets — it returns a file path (~300 bytes), not image bytes, yet captures the full picture. -
Call
chart_get_stateonce at the start to grab entity IDs, then reference them — don't re-call it repeatedly. -
Cap OHLCV requests —
count: 20for a quick look,count: 100for deeper work,count: 500only when truly needed.
| Tool | Typical output |
|---|---|
quote_get |
~200 bytes |
data_get_study_values |
~500 bytes (all indicators) |
data_get_pine_lines |
~1–3 KB per study (deduplicated levels) |
data_get_pine_labels |
~2–5 KB per study (capped at 50) |
data_get_pine_tables |
~1–4 KB per study (formatted rows) |
data_get_pine_boxes |
~1–2 KB per study (deduplicated zones) |
data_get_ohlcv (summary) |
~500 bytes |
data_get_ohlcv (100 bars) |
~8 KB |
capture_screenshot |
~300 bytes (returns file path, not image data) |
- OHLCV is capped at 500 bars per request.
-
Trades (
data_get_trades) capped at 20 per request. -
Pine labels capped at 50 per study by default — pass
max_labelsto override.
Read the smallest thing that answers the question. A screenshot beats a data dump for "how does this look." A
summary: trueOHLCV beats 500 raw bars for "what's the trend." Astudy_filtered Pine call beats scanning every study for "what does the Profiler show."
When in doubt, reach for the compact form first — you can always pull the detailed version if the summary isn't enough.
See also: Agent Workflows · Reading Custom Pine Output · Tool Reference.
TradingView MCP Bridge · 84 tools · CDP bridge to TradingView Desktop · Community project, not affiliated with TradingView
Guides
Reference
Contribute
Repo