Tool: read_cost_report
Reads and retrieves the actual data rows of a completed cost and utilization report (spend figures and resource usage). Call this tool after the report creation operation returned by create_cost_report has finished with done: true.
Row and column formatting rules: - Cost columns (type: "RECORD") are formatted as google.type.Money objects with currency_code (string, e.g. "USD"), units (int64 serialized as a JSON string), and nanos (int32 billionths, 10^-9), or null when no cost was recorded or applicable for that entity. - Utilization and usage/allocation metric columns (type: "FLOAT64") are JSON numbers, or null when not applicable to the resource (e.g. persistent disks or snapshots). - Dimension columns (type: "STRING") are JSON strings. - Returns at most 10,000 rows per page by default (25,000 maximum); paginate using next_page_token.
Empty results: When a report has zero matching cost or utilization records (for example, because the project or scope has no resources, usage, or billing charges for the configured time range and filter), the rows field is omitted from the JSON response and only columns is returned. A response containing columns without rows means the report succeeded and is validly empty — it is NOT corrupt or incomplete. Inform the user that no cost or usage data was recorded for that report's configuration, and do NOT call create_cost_report to recreate or test the report.
Required IAM on the scoped project: - roles/appoptimize.viewer or roles/appoptimize.admin to read report data.
The following code sample shows how to use curl to call the read_cost_report MCP tool.
| Curl Request |
|---|
curl --location 'https://appoptimize.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "read_cost_report", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for the ReadReport method.
ReadReportRequest
| JSON representation |
|---|
{ "name": string, "pageSize": integer, "pageToken": string } |
| Fields | |
|---|---|
name |
Required. The resource name of the report to query. Format: |
pageSize |
Optional. The maximum number of rows to return. The service may return fewer than this value. If unspecified, at most 10,000 rows will be returned per page. The maximum allowed value is 25,000; values above 25,000 are coerced to 25,000. |
pageToken |
Optional. A page token, received from a previous |
Output Schema
Response message for the ReadReport method.
ReadReportResponse
| JSON representation |
|---|
{
"rows": [
array
],
"columns": [
{
object ( |
| Fields | |
|---|---|
rows[] |
A list of rows, where each row represents a record from the report. Each |
columns[] |
The columns describing the structure and data types of the values in the |
nextPageToken |
A token that can be sent as |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Column
| JSON representation |
|---|
{
"name": string,
"type": string,
"mode": string,
"columns": [
{
object ( |
| Fields | |
|---|---|
name |
The name of the column. This field:
|
type |
The data type of the column. Supported values include:
|
mode |
The mode of the column, indicating if it is nullable, required, or repeated. Possible values:
|
columns[] |
If the |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
Tool Annotations
Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.
Along with the title string, the following boolean hints are defined as follows:
readOnlyHint: If true, the tool doesn't modify its environment. Default: false.destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌