CLI Interface¶
Overview¶
Every MCP tool has a corresponding CLI command. Output is always JSON for piping with jq.
Location: tradingview-mcp/src/cli/
Entry: tv <command> [--flags]
Dependencies: None (uses node:util parseArgs)
Usage¶
# Chart operations
tv chart_get_state
tv chart_set_symbol --symbol AAPL
tv chart_set_timeframe --timeframe 15
# Data reading
tv quote_get
tv data_get_ohlcv --summary
tv data_get_ohlcv --count 50
tv data_get_pine_labels --study_filter "Session Hunt"
# Pine Script
tv pine_compile
tv pine_get_errors
tv pine_analyze --source "$(cat myscript.pine)"
# Streaming (JSONL)
tv stream_quote | jq '.close'
tv stream_bars | jq '.time, .close'
# Replay
tv replay_start --date 2026-01-15
tv replay_step
tv replay_trade --action buy
# Multi-pane
tv pane_set_layout --layout 2x2
tv pane_set_symbol --index 1 --symbol ES1!
# Screenshots
tv capture_screenshot --region chart
Command Modules (14)¶
| Module | Commands |
|---|---|
| alerts | alert_create, alert_list, alert_delete |
| capture | capture_screenshot |
| chart | chart_get_state, chart_set_symbol, chart_set_timeframe, chart_set_type, chart_manage_indicator, chart_scroll_to_date, chart_set_visible_range, chart_get_visible_range |
| data | data_get_ohlcv, data_get_indicator, data_get_strategy_results, data_get_trades, data_get_equity, quote_get, depth_get, data_get_study_values |
| drawing | draw_shape, draw_list, draw_get_properties, draw_remove_one, draw_clear |
| health | tv_health_check, tv_launch, tv_discover, tv_ui_state |
| indicator | indicator_set_inputs, indicator_toggle_visibility |
| layout | layout_list, layout_switch |
| pane | pane_list, pane_set_layout, pane_focus, pane_set_symbol |
| pine | pine_get_source, pine_set_source, pine_compile, pine_smart_compile, pine_get_errors, pine_get_console, pine_save, pine_new, pine_open, pine_list_scripts, pine_analyze, pine_check |
| replay | replay_start, replay_step, replay_autoplay, replay_stop, replay_trade, replay_status |
| stream | stream_quote, stream_bars, stream_values, stream_lines, stream_tables, stream_all |
| tab | tab_list, tab_new, tab_close, tab_switch |
| ui | ui_click, ui_open_panel, ui_keyboard, ui_type_text, ui_hover, ui_scroll, ui_mouse_click, ui_find_element, ui_evaluate, ui_fullscreen |
| watchlist | watchlist_get, watchlist_add |