Aggregated Codex run metrics
codex_metricsAggregate token usage, duration, and failure counts from Codex metrics logs to analyze run performance. Filter by tool, session, directory, or time range; optionally include archived history.
Instructions
Roll up token/duration/failure counts from the local metrics log (~/.codex-mcp/metrics.jsonl). Set CODEX_MCP_PRICING (JSON: {inputPer1M, cachedInputPer1M, outputPer1M, reasoningOutputPer1M}) to include estCostUsd.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Filter by exact cwd. | |
| tool | No | Filter by which tool produced the run. | |
| since | No | ISO 8601 lower bound — only entries at or after this timestamp are aggregated. | |
| until | No | ISO 8601 upper bound. | |
| sessionId | No | Filter by session id. | |
| includeHistory | No | Also aggregate the archived history/*.jsonl files, not just the live + rotated log (default false). |