Using idx from an agent
MarkdownAn agent can reach idx two ways:
- MCP (setup): typed tools with input schemas, the best fit for chat-style agents.
- The CLI: for agents that run shell commands. No setup beyond
installing
idx; output is JSON automatically when captured.
Using the CLI
Section titled “Using the CLI”What an agent needs to know:
- Output is JSON whenever stdout is not a terminal, so capture it and parse
it; no flag is needed. Use
-o jsonlfor long lists. - On failure stdout is empty and stderr holds one JSON object,
{"error": true, "code": "...", "message": "..."}. - Exit codes say what to do next:
2fix the input,3not found (or no cached data offline),4provider unavailable, retry later,5unsupported,1other. - Tickers are IDX codes (
BBCA);.JKis optional. Several tickers can be passed at once tostocks quoteandstocks compare. - Ownership queries need
idx ownership synconce; after that they run offline.idx -o json ownership releasesshows which months exist.
Recipes
Section titled “Recipes”# price and day change for several stocksidx stocks quote BBCA BBRI BMRI | jq '.[] | {symbol, price, change_pct}'
# largest holders and concentrationidx ownership ticker BBCA | jq '{holders: [.holders[] | {name, pct: (.percentage_bps / 100)}], concentration}'
# what one investor holdsidx ownership entity "ANTHONI SALIM"
# holder changes between the two latest monthsidx -o json ownership releases | jq -r '.[0:2][].as_of_date'idx ownership changes --from 2026-08-31 --to 2026-09-30Percentages in ownership output are basis points (5494 = 54.94%).
Skill file
Section titled “Skill file”For harnesses that load skills (Claude Code, pi, opencode, and others),
SKILL.md packages these rules so the agent uses the
CLI correctly without MCP. Save it as idx/SKILL.md in your harness’s skills
directory, for example ~/.claude/skills/idx/SKILL.md.
Machine-readable docs
Section titled “Machine-readable docs”/llms.txt: an index of these docs for language models./llms-full.txt: every page in one file.- Any page as Markdown: add
.mdto its path, for example/agents/install.md.