Get Cost Pivot
get_cost_pivotCollect the results of a pivot job started by run_cost_pivot, using the jobId it returned. If the job is still running you get { status, pollAfterMs } and should call again in a second or two — do NOT resubmit with run_cost_pivot, that starts a second Athena query. While running, grandTotals may already be final (the org-wide totals query usually finishes first) even though the rows are not ready; that is flagged in the note and is not a completed result. When it succeeds you get the same shape run_cost_pivot returns: rows largest-_total-first, columns, grandTotals, and the window actually served. Every matching row arrives in ONE response — this backend does not page, nextCursor is always null, and cursor is inert. limit caps the list here after sorting by _total desc. ⚠ RESPONSE_TOO_LARGE (413) means the pivot is too wide to return at all: rerun run_cost_pivot with FEWER DIMENSIONS or a SHORTER WINDOW — changing limit cannot help. JOB_NOT_FOUND means the job id is not in this organization or has expired: jobs are org-scoped and discarded 24 hours after creation. Read-only. Example: { "job_id": "…", "limit": 100 } after run_cost_pivot returned a handle.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"job_id": "<job_id>"
},
"name": "get_cost_pivot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max rows to return, applied AFTER sorting by `_total` desc (default 100, max 500). | |
| cursor | No | INERT on this backend. Paging is disabled (COST_PIVOT_STANDARD_NO_PAGINATION_ENABLED), so every row arrives in the first response and `nextCursor` is always null. Sending a cursor returns INVALID_CURSOR — omit it. Kept only so callers keep working if paging is ever re-enabled. | |
| job_id | Yes | The `jobId` run_cost_pivot returned. Jobs are org-scoped and expire 24h after creation. | |
| response_format | No | concise = dimensions, `_total` and the last two time columns per row (default). detailed = every column. | concise |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Backend error code, e.g. RESPONSE_TOO_LARGE. | |
| note | No | What to do next. | |
| rows | No | Pivot rows, largest `_total` first. One key per dimension (named verbatim), one per time column, plus `_total`. On a `resource` pivot each row MAY also carry `_resource_id` and `_region` — both are optional and independent (a row can have both, either or neither), so check before using them; a missing `_resource_id` means the backend attributed none, not that the resource has none. The displayed `resource` value is sometimes the full ARN and sometimes a short name; it is the empty string "" for spend with no resource attribution (support, commitment fees, tax), and the literal "Others" for the backend collapse bucket — which can itself carry `_resource_id`/`_region`, so detect it by that string. | |
| tool | No | Which tool truncated (only on a truncated result). | |
| error | No | True on a backend error envelope. | |
| jobId | No | The pivot job. Pass to get_cost_pivot to pick it up later; expires 24h after creation. | |
| status | No | queued | running | succeeded | failed | cancelled | expired. | |
| columns | No | Time-column labels (YYYY-MM monthly, YYYY-MM-DD weekly/daily). THE authority on the window served. | |
| details | No | Backend error details, when any. | |
| message | No | How to narrow the request (only on a truncated result). | |
| nextStep | No | How to recover from the error in `code`. | |
| rowsNote | No | Present when rows were capped client-side. | |
| expiresAt | No | When the job is discarded (24h after creation). | |
| totalRows | No | How many rows matched before `limit` was applied. | |
| truncated | No | Present and true when the result exceeded the output-size budget and was WITHHELD. When you see this, no data fields are present — narrow the request as `message` says and call again. | |
| dimensions | No | The group-by actually applied, in order. Row keys use these names VERBATIM (a tag dimension is a literal "tag:<key>" key). | |
| isLastPage | No | Always true — see `nextCursor`. | |
| nextCursor | No | Always null: this backend returns every row in one response (paging is disabled). | |
| windowNote | No | Present only when the served window differs from the requested one — the backend clamps silently. Quote it. | |
| emptyReason | No | Why the pivot returned no rows. | |
| grandTotals | No | Org-wide totals per time column plus `_total`, independent of `limit`. | |
| granularity | No | monthly | weekly | daily. | |
| pollAfterMs | No | How long to wait before calling get_cost_pivot (only on a not-yet-finished job). | |
| approx_chars | No | Approximate size of the withheld result (only on a truncated result). | |
| returnedRows | No | How many rows are in `rows`. | |
| collapsedNote | No | Present when the backend folded small rows into an `Others` bucket. | |
| returnedWindow | No | The window actually served, derived from `columns`. | |
| requestedWindow | No | The window asked for, `{start, end}`. |