Agent Connect quickstart
For agent builders: pair an agent, list its tools, then change the symbol, add an indicator, set an alert and take a screenshot.
UltimateEvery request goes to https://chartlabs.co/marketplace/api/agent/. The full contract an agent reads is the agent llms.txt linked below. Keep a ChartLabs chart tab open the whole time.
- Get a code: on a chart, select Connect agent and copy the prompt. It holds a code like
K7MQ-2PXR-9TZCthat works once and expires in 10 minutes. - Pair:
POST /marketplace/api/agent/pairwith{"code": "K7MQ-2PXR-9TZC", "client": {"name": "My Agent"}}. The answer is 202 with apollToken. Select Allow in ChartLabs, then post{"pollToken": "..."}to the same URL (each poll waits up to 45 seconds) until a 200 carries the key (clak_...). The key is sent once: save it before you do anything else, and stop polling. - Connect over MCP:
claude mcp add --transport http chartlabs https://chartlabs.co/marketplace/api/agent/mcp --header "Authorization: Bearer <key>". Other MCP clients: a remote Streamable HTTP server with that URL and header. Without MCP,POST /marketplace/api/agent/callwith{"tool": "get_chart", "args": {}}and the same header. - List the tools: MCP
tools/list. Then callget_chartto see the symbol, timeframe, indicator ids and drawing ids. - Change the symbol and timeframe:
set_symbol {"symbol": "ETH/USD"}, thenset_timeframe {"timeframe": "4h"}. Use catalog symbols such as BTC/USD, EUR/USD or AAPL. Lowercasemis minutes and uppercaseMis months. - Add an indicator:
add_indicator {"indicator": "RSI"}. The answer hasindicator.id(for examplersi-1).describe_indicatorlists its settings, andtune_indicator {"indicator": "rsi-1", "parameters": {...}}changes them. - Set an alert:
create_price_alert {"symbol": "BTC/USD", "condition": "crosses_above", "price": 100000}. It answers with anidthatdelete_agent_alerttakes. - Take a screenshot:
screenshot {}. Over MCP it is an image. Over/callit is{mimeType, dataUrl, width, height}. For analysis, readget_barsandget_indicator_datainstead: exact numbers, far less context. - Clean up:
undo {}reverses your last chart change. Your user can disconnect you at any time.
Answers and errors
Over /call every answer is {"ok": true, "result": ...} or {"ok": false, "error": "...", "code": "..."}. Over MCP a tool failure is a result with isError: true and the code in structuredContent.code. A bad or unknown argument is a JSON-RPC error -32602 instead, and nothing ran. Branch on the code, never the text.
| Code | What to do |
|---|---|
| NO_TAB | No ChartLabs tab is open. Ask the user to open chartlabs.co/charts. |
| CHART_GONE | The chart you work on closed. Call list_charts and pass a chartId. |
| INVALID_ARGS | Fix the arguments. The message names the ones the tool takes. |
| NOT_ENTITLED | The account lacks that indicator or feature. Tell the user. Do not retry. |
| DECLINED | The user said No. That is final. |
| FAILED | Nothing changed. Do what the message says. |
| TIMEOUT | The tab did not answer in time. Read get_chart before you send it again. |
| RATE_LIMITED | Wait for the Retry-After time. |
| AGENT_KEY_INVALID (401) | The key expired or was disconnected. Ask the user for a new code. |