Skip to content

Output Formats

Wallace Ricardo edited this page Apr 11, 2026 · 2 revisions

Output Formats

Most result-printing commands (such as query, mutation, queries, mutations, and types) accept -f / --format to control how results are printed. The default format varies by command but is usually toon.

Available Formats

toon (default for most commands)

Token-optimized output. Strips noise from the response to reduce character count by 40–60%. Designed for piping to LLMs or storing in context windows.

gqlcli queries -f toon

json-pretty

Full JSON output with indentation. Useful for reading or debugging.

gqlcli query --query "{ users { id name } }" -f json-pretty

json

Compact JSON, no indentation.

gqlcli query --query "{ users { id name } }" -f json

compact

Minimal JSON — the same fields as the regular JSON response, but without indentation. Useful when you want a small payload but still keep the full structure. If you also want to strip null values from the response envelope, use json/json-pretty, which apply a light cleanup.

gqlcli types -f compact

table

Aligned columns, human-readable in the terminal.

gqlcli queries -f table
gqlcli mutations --filter user -f table

llm

Markdown-formatted output intended for feeding into AI systems.

gqlcli queries --desc -f llm
gqlcli mutations --desc --args -f llm

Choosing a Format

Use Case Recommended Format
Terminal reading table
Script/pipeline json or compact
LLM context toon or llm
Debugging json-pretty
File storage json

Saving to File

Any command can write its output to a file with --output:

gqlcli types -f json --output schema-types.json
gqlcli queries --desc -f llm --output queries.md

Format Examples

Given a queries response with a users field:

toon:

users: [User]
getUser(id: ID!): User

table:

NAME      TYPE     DESCRIPTION
users     [User]   List all users
getUser   User     Get user by ID

json-pretty:

{
  "data": {
    "users": {
      "name": "users",
      "type": "[User]",
      "description": "List all users"
    }
  }
}

Clone this wiki locally