Skip to main content
Glama

Get Cost Pivot

get_cost_pivot
Read-only

Collect 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

NameRequiredDescriptionDefault
limitNoMax rows to return, applied AFTER sorting by `_total` desc (default 100, max 500).
cursorNoINERT 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_idYesThe `jobId` run_cost_pivot returned. Jobs are org-scoped and expire 24h after creation.
response_formatNoconcise = dimensions, `_total` and the last two time columns per row (default). detailed = every column.concise

Output Schema

NameRequiredDescriptionDefault
codeNoBackend error code, e.g. RESPONSE_TOO_LARGE.
noteNoWhat to do next.
rowsNoPivot 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.
toolNoWhich tool truncated (only on a truncated result).
errorNoTrue on a backend error envelope.
jobIdNoThe pivot job. Pass to get_cost_pivot to pick it up later; expires 24h after creation.
statusNoqueued | running | succeeded | failed | cancelled | expired.
columnsNoTime-column labels (YYYY-MM monthly, YYYY-MM-DD weekly/daily). THE authority on the window served.
detailsNoBackend error details, when any.
messageNoHow to narrow the request (only on a truncated result).
nextStepNoHow to recover from the error in `code`.
rowsNoteNoPresent when rows were capped client-side.
expiresAtNoWhen the job is discarded (24h after creation).
totalRowsNoHow many rows matched before `limit` was applied.
truncatedNoPresent 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.
dimensionsNoThe group-by actually applied, in order. Row keys use these names VERBATIM (a tag dimension is a literal "tag:<key>" key).
isLastPageNoAlways true — see `nextCursor`.
nextCursorNoAlways null: this backend returns every row in one response (paging is disabled).
windowNoteNoPresent only when the served window differs from the requested one — the backend clamps silently. Quote it.
emptyReasonNoWhy the pivot returned no rows.
grandTotalsNoOrg-wide totals per time column plus `_total`, independent of `limit`.
granularityNomonthly | weekly | daily.
pollAfterMsNoHow long to wait before calling get_cost_pivot (only on a not-yet-finished job).
approx_charsNoApproximate size of the withheld result (only on a truncated result).
returnedRowsNoHow many rows are in `rows`.
collapsedNoteNoPresent when the backend folded small rows into an `Others` bucket.
returnedWindowNoThe window actually served, derived from `columns`.
requestedWindowNoThe window asked for, `{start, end}`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only declare readOnlyHint and openWorldHint; the description goes far beyond them with non-paged delivery, `nextCursor` always null, partial `grandTotals` during a run, 413 meaning the pivot is too wide, and 24-hour org-scoped job expiry. Nothing here contradicts the read-only annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The happy path and polling behavior come first, error cases follow, and the example closes it out; the warning glyph on 413 makes the highest-risk failure scannable. Some schema restatement (cursor inert) is mildly duplicative but reinforces a trap-prone parameter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a polling retrieval tool with an output schema already documenting the return shape, the description covers everything an agent needs: prerequisite job handle, retry cadence, non-paging semantics, width/window remedies, and expiry. No meaningful gap remains.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description earns extra credit by explaining interaction effects the schema cannot, notably that `limit` is applied after `_total` sorting and that changing `limit` will not resolve a too-large response. The cursor/job_id restatements add little beyond the schema's own text.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence names a specific verb and resource (collect results of a pivot job) and ties it to the producer tool: 'started by run_cost_pivot, using the `jobId` it returned.' An agent can immediately distinguish this retrieval tool from the sibling that creates the job.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It spells out the polling loop ('if the job is still running ... call again in a second or two'), explicitly forbids the wrong alternative ('do NOT resubmit with run_cost_pivot, that starts a second Athena query'), and gives concrete recovery paths for RESPONSE_TOO_LARGE and JOB_NOT_FOUND.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources