Learn
CLI

CLI

tracepath is a command-line client for the TracePath HTTP API: exceptions, logs, endpoints, tasks, traces, and metrics from a terminal. It is designed to be first-class for both humans (with gh-style ergonomics) and LLM agents invoking it via shell tools: JSON output when piped, stable error identifiers and exit codes, and nothing that hangs waiting for input.

Availability

⚠️

The CLI is not distributed yet. There is no published download, install script, or package for it today, and this page documents the interface rather than a binary you can fetch. Everything the CLI does is also available from the HTTP API and the dashboard in the meantime. Write to [email protected] if you want to be told when builds go out.

The rest of this page describes the command surface and the conventions it follows, so you can see whether it fits your workflow before it ships. The MCP Server covers the same query surface and is available today over a remote endpoint that needs nothing installed.

Quick start

Once you have a binary on your PATH:

# 1. log in: prints a URL + short code, you approve in the browser
tracepath login --url https://app.tracepath.dev
 
# 2. pick a project (one-time; future calls use it implicitly)
tracepath projects list
tracepath projects use <project-id>
 
# 3. ask questions
tracepath exceptions list --since 24h
tracepath logs query --since 1h --search "OutOfMemory"
tracepath endpoints list --since 1h
tracepath metrics query --name http.server.duration --aggregation avg --since 1h

Pass --url https://app.tracepath.dev on the first login; it is stored in the profile, so later commands do not repeat it. tracepath login with no other flags runs a browser device flow with an auto-refreshing token, so you stay logged in for up to 90 days of inactivity. Password login (--password) and personal access tokens (--token) are also supported; see CLI Authentication for all three modes, and for what to use in CI.

Commands

CommandPurpose
tracepath loginAuthenticate and store a token (device flow, --password, or --token)
tracepath logoutRevoke the session server-side and forget stored credentials
tracepath profiles {list,use}Manage multiple TracePath accounts/instances
tracepath projects {list,use}List or select the active project
tracepath exceptions listRecent grouped exceptions
tracepath exceptions show <hash>A single exception group + occurrences
tracepath exceptions occurrence <id> --recorded-at <t>A single occurrence by id (+ sessionId and recording)
tracepath exceptions archive <hash>...Archive one or more groups (mutating; needs --yes non-interactively)
tracepath exceptions unarchive <hash>...Unarchive (mutating; needs --yes non-interactively)
tracepath logs queryQuery logs with severity / service / search filters
tracepath endpoints listPer-endpoint p50/p95/p99 stats
tracepath endpoints show <id> --recorded-at <t>A single request (transaction) by id: spans + linked errors
tracepath tasks show <id> --recorded-at <t>A single background task run by id
tracepath ai-traces show <id> --recorded-at <t>A single AI trace by id + its conversation
tracepath sessions show <id> --started-at <t>A single session by id + the exceptions that fired in it
tracepath traces show <id> --recorded-at <t>A distributed trace: every service node sharing the id
tracepath metrics queryTime-series metric queries
tracepath mcpServe the MCP server over stdio

Run tracepath <command> --help for full per-command flags.

The show / occurrence commands take a UUID plus a required timestamp flag (--recorded-at, or --started-at for sessions). Telemetry tables are partitioned by day; the timestamp bounds the query so the lookup prunes partitions instead of scanning all of them. Get the id and its timestamp together: from a dashboard URL's ?t= param, a notification's Occurred at, or a list row's recordedAt. Omitting the flag exits 2 (usage_error).

Profiles

Several TracePath accounts coexist via profiles — useful when you belong to more than one organization, or want a separate read-only identity for scripts. Configuration (URL, username) lives in $XDG_CONFIG_HOME/tracepath/config.json so it can be checked in or managed declaratively; credentials and the active project live in $XDG_STATE_HOME/tracepath/state.json.

tracepath login --url https://app.tracepath.dev --profile work
tracepath profiles list
tracepath profiles use work
tracepath --profile personal exceptions list   # one-off override

Output formats

The --output flag picks the format. The default is table on a TTY and json otherwise, so piping always gets machine-readable output.

FormatUse
tableHuman-friendly columns (default on TTY)
jsonCompact JSON, one record per line (default when stdout isn't a TTY)
yamlYAML rendering of the same data

--fields a,b,c projects list responses to just those keys:

tracepath exceptions list --output json --fields exceptionHash,count,lastSeen

Errors and exit codes

Every error writes a stable JSON envelope to stderr (in json / yaml modes; prose in table mode):

{"error":"token_expired","message":"session expired or invalid","hint":"tracepath login","exit_code":4}

The error field is a stable snake_case identifier that scripts and LLMs can branch on. Exit codes:

ExitMeaning
0Success
1Generic / API error
2Usage error (bad flags, missing confirmation, invalid time range)
3Connection failure
4Auth failure (not_authenticated, token_expired, forbidden)
5Not found
6Rate limited
7Server (5xx)

Mutations require confirmation

exceptions archive and exceptions unarchive are the only commands that change server state, and they require explicit consent:

  • Pass --yes to skip the prompt.
  • Or set TRACEPATH_ASSUME_YES=1 in the environment.
  • Or run interactively and answer the Continue? [y/N] prompt.

Calling a mutating command from a non-TTY context (script, LLM tool call) without one of the opt-ins fails immediately with usage_error (exit 2); no hung prompts.

MCP server

tracepath mcp serves the whole query/debug surface as an MCP server on stdio for clients like Claude Code, Claude Desktop, and Cursor, reusing the CLI session and current project. See MCP Server for the stdio setup, the zero-install remote server every backend hosts at /mcp, and headless use via TRACEPATH_URL + TRACEPATH_TOKEN.