Chat2DB CLI
Use the chat2db command directly. Prefer live command output and
chat2db <command> --help over static examples.
Start Here
command -v chat2db && chat2db version --json
chat2db status --json
If chat2db is missing, do not install it silently. Tell the user the
appropriate install command from references/installation.md.
This Skill supports CLI versions >=0.2, <0.3. Outside that range, say that
the Skill may be stale and continue from chat2db --help and
chat2db <command> --help.
Edition Selection
- Use
community when the user does not specify an edition.
- Use
pro or local only when the user requests that product or the
current state clearly belongs to it.
- Use
all only for commands that explicitly support it. The order is
Community, Pro, then Local.
- Community has no account authentication.
login and logout with
--edition community return not_applicable and must not open an
authentication flow.
Community runtime, db, and sql commands require a compatible Chat2DB
Community 5.3.0 or later build. The CLI validates the runtime edition, API
version, and capabilities before sending business data. Report any contract
error; never retry against Local or Pro.
Read references/editions.md for the complete edition
matrix and paths.
Priority
- Run
chat2db status --json before choosing follow-up commands. Read
data.summary.<edition>, safe_to_exit, and next_action.
- Prefer
chat2db runtime, chat2db db, and chat2db sql for database
work. These commands may start the headless runtime but should not open the
GUI.
- Start, install, stop, or restart the desktop app only when the user asks for
that lifecycle action.
- Use
chat2db mcp only for an explicit MCP request or when direct
runtime/database/SQL commands cannot perform the task.
- Use
--json whenever command output will be parsed.
Common Commands
| Task |
Command |
| Inspect all editions |
chat2db status --json |
| Community runtime status |
chat2db runtime status --edition community --json |
| List Community datasources |
chat2db db datasources --edition community --json |
| Show a datasource |
chat2db db datasource --data-source-id <id> --edition community --json |
| Test a saved datasource |
chat2db db connection-test --data-source-id <id> --edition community --json |
| List databases |
chat2db db databases --data-source-id <id> --edition community --json |
| List schemas |
chat2db db schemas --data-source-id <id> --database <db> --edition community --json |
| List tables |
chat2db db tables --data-source-id <id> --database <db> --schema <schema> --edition community --json |
| Inspect a table |
chat2db db table --data-source-id <id> --database <db> --schema <schema> --table <table> --edition community --json |
| Query SQL |
chat2db sql query --data-source-id <id> --database <db> --schema <schema> --sql '<sql>' --edition community --json |
| MCP status |
chat2db mcp status --edition community --json |
| MCP tools |
chat2db mcp tools --edition community --json |
| Install Skill for Codex |
chat2db skill install --client codex --json |
| Update CLI |
chat2db update --json |
Read references/commands.md for complete command
shapes and flags.
Datasource Flow
- List existing datasources for the selected edition.
- Test user-supplied connection fields before creating a datasource when the
password is non-empty.
- Use either
--url or --host --port --database; do not mix them.
- Keep
--password present for datasource creation, including an explicitly
empty password.
- Create only after a successful connection test, except for an intentionally
empty-password datasource that cannot use the temporary test form.
- Treat environment ids as
1=TEST and 2=RELEASE; default to 1 when
the user does not specify one.
SQL Flow
- Use
--page-no and --page-size for result paging.
- If
hasNextPage is true, rerun the same SQL with the next page number.
- Use
--result-set-id for a specific result from multi-result SQL.
- Use
--no-row-number when downstream consumers need only database
columns.
Safety
- Parse
ok, data, error.code, error.details, error.hint,
error.next_action, error.retryable, and error.risk. Do not branch
on prose messages.
- Do not pass
--json to chat2db logs; it streams log text.
- Run login only when explicitly requested. Never turn a Community
not_applicable result into a Pro or Local login attempt.
- Do not install a missing edition unless the user asked for installation.
- Use
--dry-run --json for writes with unclear impact. Use --yes only
for explicit destructive intent.
- Do not retry an unchanged command when
error.retryable is false.
- Do not auto-retry integrity, official-source, or unsafe-path errors.
- Poll long operations once or twice, then report their state.
- Redact passwords, tokens, cookies, and bearer values from user-facing output.
chat2db mcp config intentionally includes a selected edition's MCP token;
show it only when the user explicitly requests MCP client configuration.
References
Read a reference only when the live command help is insufficient.
| Need |
Reference |
| Full command surface |
references/commands.md |
| Edition behavior and paths |
references/editions.md |
| JSON envelopes and fields |
references/json-output.md |
| Error recovery |
references/error-codes.md |
| Background installation |
references/background-install.md |
| Login behavior |
references/login-flow.md |
| CLI and Skill installation |
references/installation.md |
| Symptom troubleshooting |
references/troubleshooting.md |
1---2name: chat2db-cli3description: Operate Chat2DB Community, Pro, and Local through the chat2db CLI: inspect status, manage the app and headless runtime, work with datasources and SQL, configure MCP, manage the Skill, and update the CLI. Use for CLI-driven Chat2DB workflows, not GUI interaction.4---56# Chat2DB CLI78Use the `chat2db` command directly. Prefer live command output and9`chat2db <command> --help` over static examples.1011## Start Here1213```bash14command -v chat2db && chat2db version --json15chat2db status --json16```1718If `chat2db` is missing, do not install it silently. Tell the user the19appropriate install command from [references/installation.md](references/installation.md).2021This Skill supports CLI versions `>=0.2, <0.3`. Outside that range, say that22the Skill may be stale and continue from `chat2db --help` and23`chat2db <command> --help`.2425## Edition Selection2627- Use `community` when the user does not specify an edition.28- Use `pro` or `local` only when the user requests that product or the29 current state clearly belongs to it.30- Use `all` only for commands that explicitly support it. The order is31 Community, Pro, then Local.32- Community has no account authentication. `login` and `logout` with33 `--edition community` return `not_applicable` and must not open an34 authentication flow.3536Community `runtime`, `db`, and `sql` commands require a compatible Chat2DB37Community 5.3.0 or later build. The CLI validates the runtime edition, API38version, and capabilities before sending business data. Report any contract39error; never retry against Local or Pro.4041Read [references/editions.md](references/editions.md) for the complete edition42matrix and paths.4344## Priority45461. Run `chat2db status --json` before choosing follow-up commands. Read47 `data.summary.<edition>`, `safe_to_exit`, and `next_action`.482. Prefer `chat2db runtime`, `chat2db db`, and `chat2db sql` for database49 work. These commands may start the headless runtime but should not open the50 GUI.513. Start, install, stop, or restart the desktop app only when the user asks for52 that lifecycle action.534. Use `chat2db mcp` only for an explicit MCP request or when direct54 runtime/database/SQL commands cannot perform the task.555. Use `--json` whenever command output will be parsed.5657## Common Commands5859| Task | Command |60| --- | --- |61| Inspect all editions | `chat2db status --json` |62| Community runtime status | `chat2db runtime status --edition community --json` |63| List Community datasources | `chat2db db datasources --edition community --json` |64| Show a datasource | `chat2db db datasource --data-source-id <id> --edition community --json` |65| Test a saved datasource | `chat2db db connection-test --data-source-id <id> --edition community --json` |66| List databases | `chat2db db databases --data-source-id <id> --edition community --json` |67| List schemas | `chat2db db schemas --data-source-id <id> --database <db> --edition community --json` |68| List tables | `chat2db db tables --data-source-id <id> --database <db> --schema <schema> --edition community --json` |69| Inspect a table | `chat2db db table --data-source-id <id> --database <db> --schema <schema> --table <table> --edition community --json` |70| Query SQL | `chat2db sql query --data-source-id <id> --database <db> --schema <schema> --sql '<sql>' --edition community --json` |71| MCP status | `chat2db mcp status --edition community --json` |72| MCP tools | `chat2db mcp tools --edition community --json` |73| Install Skill for Codex | `chat2db skill install --client codex --json` |74| Update CLI | `chat2db update --json` |7576Read [references/commands.md](references/commands.md) for complete command77shapes and flags.7879## Datasource Flow80811. List existing datasources for the selected edition.822. Test user-supplied connection fields before creating a datasource when the83 password is non-empty.843. Use either `--url` or `--host --port --database`; do not mix them.854. Keep `--password` present for datasource creation, including an explicitly86 empty password.875. Create only after a successful connection test, except for an intentionally88 empty-password datasource that cannot use the temporary test form.896. Treat environment ids as `1=TEST` and `2=RELEASE`; default to `1` when90 the user does not specify one.9192## SQL Flow93941. Use `--page-no` and `--page-size` for result paging.952. If `hasNextPage` is true, rerun the same SQL with the next page number.963. Use `--result-set-id` for a specific result from multi-result SQL.974. Use `--no-row-number` when downstream consumers need only database98 columns.99100## Safety101102- Parse `ok`, `data`, `error.code`, `error.details`, `error.hint`,103 `error.next_action`, `error.retryable`, and `error.risk`. Do not branch104 on prose messages.105- Do not pass `--json` to `chat2db logs`; it streams log text.106- Run login only when explicitly requested. Never turn a Community107 `not_applicable` result into a Pro or Local login attempt.108- Do not install a missing edition unless the user asked for installation.109- Use `--dry-run --json` for writes with unclear impact. Use `--yes` only110 for explicit destructive intent.111- Do not retry an unchanged command when `error.retryable` is false.112- Do not auto-retry integrity, official-source, or unsafe-path errors.113- Poll long operations once or twice, then report their state.114- Redact passwords, tokens, cookies, and bearer values from user-facing output.115- `chat2db mcp config` intentionally includes a selected edition's MCP token;116 show it only when the user explicitly requests MCP client configuration.117118## References119120Read a reference only when the live command help is insufficient.121122| Need | Reference |123| --- | --- |124| Full command surface | [references/commands.md](references/commands.md) |125| Edition behavior and paths | [references/editions.md](references/editions.md) |126| JSON envelopes and fields | [references/json-output.md](references/json-output.md) |127| Error recovery | [references/error-codes.md](references/error-codes.md) |128| Background installation | [references/background-install.md](references/background-install.md) |129| Login behavior | [references/login-flow.md](references/login-flow.md) |130| CLI and Skill installation | [references/installation.md](references/installation.md) |131| Symptom troubleshooting | [references/troubleshooting.md](references/troubleshooting.md) |