Structured Output Schema

March 10, 2026 ยท View on GitHub

tg-cli uses a shared agent-friendly envelope for machine-readable output.

Success

ok: true
schema_version: "1"
data: ...

Error

ok: false
schema_version: "1"
error:
  code: chat_not_found
  message: Chat 'foo' not found in database.

Notes

  • --yaml and --json both use this envelope
  • non-TTY stdout defaults to YAML
  • query commands usually return lists or dicts inside data
  • status returns data.authenticated plus data.user
  • whoami returns data.user