Agent Connect quickstart

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.

Ultimate

Every 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.

  1. Get a code: on a chart, select Connect agent and copy the prompt. It holds a code like K7MQ-2PXR-9TZC that works once and expires in 10 minutes.
  2. Pair: POST /marketplace/api/agent/pair with {"code": "K7MQ-2PXR-9TZC", "client": {"name": "My Agent"}}. The answer is 202 with a pollToken. 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.
  3. 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/call with {"tool": "get_chart", "args": {}} and the same header.
  4. List the tools: MCP tools/list. Then call get_chart to see the symbol, timeframe, indicator ids and drawing ids.
  5. Change the symbol and timeframe: set_symbol {"symbol": "ETH/USD"}, then set_timeframe {"timeframe": "4h"}. Use catalog symbols such as BTC/USD, EUR/USD or AAPL. Lowercase m is minutes and uppercase M is months.
  6. Add an indicator: add_indicator {"indicator": "RSI"}. The answer has indicator.id (for example rsi-1). describe_indicator lists its settings, and tune_indicator {"indicator": "rsi-1", "parameters": {...}} changes them.
  7. Set an alert: create_price_alert {"symbol": "BTC/USD", "condition": "crosses_above", "price": 100000}. It answers with an id that delete_agent_alert takes.
  8. Take a screenshot: screenshot {}. Over MCP it is an image. Over /call it is {mimeType, dataUrl, width, height}. For analysis, read get_bars and get_indicator_data instead: exact numbers, far less context.
  9. 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.

CodeWhat to do
NO_TABNo ChartLabs tab is open. Ask the user to open chartlabs.co/charts.
CHART_GONEThe chart you work on closed. Call list_charts and pass a chartId.
INVALID_ARGSFix the arguments. The message names the ones the tool takes.
NOT_ENTITLEDThe account lacks that indicator or feature. Tell the user. Do not retry.
DECLINEDThe user said No. That is final.
FAILEDNothing changed. Do what the message says.
TIMEOUTThe tab did not answer in time. Read get_chart before you send it again.
RATE_LIMITEDWait for the Retry-After time.
AGENT_KEY_INVALID (401)The key expired or was disconnected. Ask the user for a new code.