Aggregated Codex run metrics
codex_metricsCalculate token usage, duration, and failure counts from the local metrics log, and optionally estimate costs when pricing is set. Filter results by tool, session, cwd, or time range.
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. |