MCP Tools Reference: databaseinsights.googleapis.com

Tool: get_advanced_aggregated_query_stats

Fetches aggregated query execution statistics for a requested AlloyDB instance within a specified time period. Supports filtering by database name, database user, and a specific query ID, as well as pagination. Returns statistics including query ID, database name, total execution time (sum(execution_time)), average execution time (avg(execution_time)), total execution count (sum(count)), total wait time (sum(wait_time)), and normalized query text. Requires advanced query insights to be enabled.

The following sample demonstrate how to use curl to invoke the get_advanced_aggregated_query_stats MCP tool.

Curl Request
                  
curl --location 'https://databaseinsights.googleapis.com/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "get_advanced_aggregated_query_stats",
    "arguments": {
      // provide these details according to the tool's MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

Input Schema

Message for fetching query execution statistics (including execution times, count, wait times, and normalized query text) for the requested instance.

FetchQueryStatsRequest

JSON representation
{
  "parent": string,
  "fullResourceName": string,
  "startTime": string,
  "endTime": string,
  "database": string,
  "username": string,
  "queryId": string,
  "pageSize": integer,
  "pageToken": string
}
Fields
parent

string

Required. The name of the location where we request stats. Format: projects/{project}/locations/{location}

fullResourceName

string

Required. Identifies the AlloyDB instance. //alloydb.googleapis.com/clusters/{cluster}/instances/{instance}

startTime

string

Optional. The beginning of the interval for fetching stats in RFC3339 format.

endTime

string

Optional. The end of the interval for fetching stats in RFC3339 format.

database

string

Optional. Filters results to a specific database name.

username

string

Optional. Filters results to a specific database user.

queryId

string (int64 format)

Optional. Fetches aggregated stats for a single, specific query ID.

pageSize

integer

Optional. The maximum number of query stats to return.

pageToken

string

Optional. Token for fetching the next set of results.

Output Schema

Response message containing query execution statistics, including query ID, database, sum and average of execution time, execution count, sum of wait time, and normalized query text.

FetchQueryStatsResponse

JSON representation
{
  "results": [
    array
  ],
  "metadata": {
    object (ResultSetMetadata)
  },
  "nextPageToken": string
}
Fields
results[]

array (ListValue format)

Rows of data returned based on the user query.

metadata

object (ResultSetMetadata)

List of all the fields the client has interactions for.

nextPageToken

string

Support for pagination.

ListValue

JSON representation
{
  "values": [
    value
  ]
}
Fields
values[]

value (Value format)

Repeated field of dynamically typed values.

Value

JSON representation
{

  // Union field kind can be only one of the following:
  "nullValue": null,
  "numberValue": number,
  "stringValue": string,
  "boolValue": boolean,
  "structValue": {
    object
  },
  "listValue": array
  // End of list of possible types for union field kind.
}
Fields
Union field kind. The kind of value. kind can be only one of the following:
nullValue

null

Represents a JSON null.

numberValue

number

Represents a JSON number. Must not be NaN, Infinity or -Infinity, since those are not supported in JSON. This also cannot represent large Int64 values, since JSON format generally does not support them in its number type.

stringValue

string

Represents a JSON string.

boolValue

boolean

Represents a JSON boolean (true or false literal in JSON).

structValue

object (Struct format)

Represents a JSON object.

listValue

array (ListValue format)

Represents a JSON array.

Struct

JSON representation
{
  "fields": {
    string: value,
    ...
  }
}
Fields
fields

map (key: string, value: value (Value format))

Unordered map of dynamically typed values.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

FieldsEntry

JSON representation
{
  "key": string,
  "value": value
}
Fields
key

string

value

value (Value format)

ResultSetMetadata

JSON representation
{
  "fields": [
    {
      object (Field)
    }
  ]
}
Fields
fields[]

object (Field)

Information on all columns of the result row.

Field

JSON representation
{
  "name": string,
  "type": enum (FieldType),
  "description": string
}
Fields
name

string

Field name according to the public schema.

type

enum (FieldType)

Field type defined according to the public schema or depends on the aggregation method in case of an aggregation field.

description

string

Description of the value the field holds.

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.

FieldType

Type of field, which will define how to read a particular key.

Enums
FIELD_TYPE_UNSPECIFIED Field type is unknown.
INT64 Int64 field type.
UINT64 Unsigned int64 field type.
INT32 Int32 field type.
UINT32 Unsigned int64 field type.
STRING String field type.
DOUBLE Double based data type.
ARRAY Trace info type.
BOOL Boolean field type.

Tool Annotations

Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌