Tool: execute_sql
Executes a SQL query against a Bigtable instance. The tool returns at least 10 MiB of the proto-serialized result set (or just one row if the size of the proto-serialized representation of the row exceeds 10 MiB). The RPC may return more than 10 MiB of proto-serialized result set for performance reasons.
To support dynamic routing (which directs requests to the region where your data resides), set the x-goog-request-params header in the HTTP request to instance_name=<INSTANCE_NAME>. The instance name is the fully qualified resource name (e.g., projects/my-project/instances/my-instance). It can be provided as-is (raw string) or URL-encoded (e.g., projects%2Fmy-project%2Finstances%2Fmy-instance).
The following sample demonstrate how to use curl to invoke the execute_sql MCP tool.
| Curl Request |
|---|
curl --location 'https://bigtable.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "execute_sql", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for Bigtable.ExecuteSql
ExecuteSqlRequest
| JSON representation |
|---|
{
"projectId": string,
"instanceId": string,
"appProfileId": string,
"query": string,
"viewParameters": {
string: {
object ( |
| Fields | |
|---|---|
projectId |
Required. The project ID (e.g., "my-project"). If not known from the context, the Agent should attempt to get the current project ID from the gcloud config by running |
instanceId |
Required. The instance ID within the project against which the query will be executed (e.g., just "myinstance" rather than "projects/myproject/instances/myinstance"). |
appProfileId |
Optional. This value specifies routing for replication. If not specified, the |
query |
Required. The SQL query string. |
viewParameters |
This map provides the runtime values returned by the VIEW_PARAMETERS() function calls, typically used for user-level scoping of data based on identity. The key is the name of the view parameter e.g. An object containing a list of |
ViewParametersEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ "partial": boolean, "type": { object ( |
| Fields | |
|---|---|
partial |
Output only. If a value is partial, it must be merged with one or more values in the right order to construct a complete value. The last partial value will have this set to |
type |
The verified Read results will never specify the encoding for When using composite types (Struct, Array, Map) only the outermost |
Union field The value is |
|
rawValue |
Represents a raw byte sequence with no type information. The A base64-encoded string. |
rawTimestampMicros |
Represents a raw cell timestamp with no type information. The |
bytesValue |
Represents a typed value transported as a byte sequence. A base64-encoded string. |
stringValue |
Represents a typed value transported as a string. |
intValue |
Represents a typed value transported as an integer. |
boolValue |
Represents a typed value transported as a boolean. |
floatValue |
Represents a typed value transported as a floating point number. Does not support NaN or infinities. |
timestampValue |
Represents a typed value transported as a timestamp. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
dateValue |
Represents a typed value transported as a date. |
arrayValue |
Represents a typed value transported as a sequence of values. To differentiate between |
Type
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of type that this represents. kind can be only one of the following: |
|
bytesType |
Bytes |
stringType |
String |
int64Type |
Int64 |
float32Type |
Float32 |
float64Type |
Float64 |
boolType |
Bool |
timestampType |
Timestamp |
dateType |
Date |
aggregateType |
Aggregate |
structType |
Struct |
arrayType |
Array |
mapType |
Map |
protoType |
Proto |
enumType |
Enum |
geographyType |
Geography |
int32Type |
Int32 |
Bytes
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
raw |
Use |
Raw
| JSON representation |
|---|
{ "escapeNulls": boolean } |
| Fields | |
|---|---|
escapeNulls |
If set, allows NULL values to be encoded as the empty string "". The actual empty string, or any value which only contains the null byte |
String
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
utf8Raw |
Deprecated: if set, converts to an empty |
utf8Bytes |
Use |
Utf8Bytes
| JSON representation |
|---|
{ "nullEscapeChar": string } |
| Fields | |
|---|---|
nullEscapeChar |
Single-character escape sequence used to support NULL values. If set, allows NULL values to be encoded as the empty string "". The actual empty string, or any value where every character equals If . |
Int64
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
bigEndianBytes |
Use |
orderedCodeBytes |
Use |
BigEndianBytes
| JSON representation |
|---|
{
"bytesType": {
object ( |
| Fields | |
|---|---|
bytesType |
Deprecated: ignored if set. |
Float64
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
bigEndianBytes |
Use |
Bool
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
Specifies the encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
sentinelBytes |
Required. Use |
SentinelBytes
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
trueValue |
Optional. The value to use for A base64-encoded string. |
Union field
|
|
falseValue |
Optional. The value to use for A base64-encoded string. |
Timestamp
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
unixMicrosInt64 |
Encodes the number of microseconds since the Unix epoch using the given Compatible with:
|
Aggregate
| JSON representation |
|---|
{ "inputType": { object ( |
| Fields | |
|---|---|
inputType |
Type of the inputs that are accumulated by this |
stateType |
Output only. Type that holds the internal accumulator state for the |
Union field aggregator. Which aggregator function to use. The configured types must match. aggregator can be only one of the following: |
|
sum |
Sum aggregator. |
hllppUniqueCount |
HyperLogLogPlusPlusUniqueCount aggregator. |
max |
Max aggregator. |
min |
Min aggregator. |
kllQuantiles |
KllQuantiles aggregator. |
Struct
| JSON representation |
|---|
{ "fields": [ { object ( |
| Fields | |
|---|---|
fields[] |
The names and types of the fields in this struct. |
encoding |
The encoding to use when converting to or from lower level types. |
Field
| JSON representation |
|---|
{
"fieldName": string,
"type": {
object ( |
| Fields | |
|---|---|
fieldName |
The field name (optional). Fields without a |
type |
The type of values in this field. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
singleton |
Use |
delimitedBytes |
Use |
orderedCodeBytes |
User |
DelimitedBytes
| JSON representation |
|---|
{ "delimiter": string } |
| Fields | |
|---|---|
delimiter |
Byte sequence used to delimit concatenated fields. The delimiter must contain at least 1 character and at most 50 characters. A base64-encoded string. |
Array
| JSON representation |
|---|
{
"elementType": {
object ( |
| Fields | |
|---|---|
elementType |
The type of the elements in the array. This must not be |
Map
| JSON representation |
|---|
{ "keyType": { object ( |
| Fields | |
|---|---|
keyType |
The type of a map key. Only |
valueType |
The type of the values in a map. |
Proto
| JSON representation |
|---|
{ "schemaBundleId": string, "messageName": string } |
| Fields | |
|---|---|
schemaBundleId |
The ID of the schema bundle that this proto is defined in. |
messageName |
The fully qualified name of the protobuf message, including package. In the format of "foo.bar.Message". |
Enum
| JSON representation |
|---|
{ "schemaBundleId": string, "enumName": string } |
| Fields | |
|---|---|
schemaBundleId |
The ID of the schema bundle that this enum is defined in. |
enumName |
The fully qualified name of the protobuf enum message, including package. In the format of "foo.bar.EnumMessage". |
Int32
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
bigEndianBytes |
Use |
orderedCodeBytes |
Use |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
Date
| JSON representation |
|---|
{ "year": integer, "month": integer, "day": integer } |
| Fields | |
|---|---|
year |
Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. |
month |
Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. |
day |
Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. |
ArrayValue
| JSON representation |
|---|
{
"values": [
{
object ( |
| Fields | |
|---|---|
values[] |
The ordered elements in the array. |
Output Schema
Response message for Bigtable.ExecuteSql
ExecuteSqlResponse
| JSON representation |
|---|
{ "columns": [ { object ( |
| Fields | |
|---|---|
columns[] |
The columns in the result set. |
rows[] |
The rows in the result set wherein each row contains values with schema matching the |
truncated |
Whether the response is truncated. |
ColumnMetadata
| JSON representation |
|---|
{
"name": string,
"type": {
object ( |
| Fields | |
|---|---|
name |
The name of the column. |
type |
The type of the column. |
Type
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of type that this represents. kind can be only one of the following: |
|
bytesType |
Bytes |
stringType |
String |
int64Type |
Int64 |
float32Type |
Float32 |
float64Type |
Float64 |
boolType |
Bool |
timestampType |
Timestamp |
dateType |
Date |
aggregateType |
Aggregate |
structType |
Struct |
arrayType |
Array |
mapType |
Map |
protoType |
Proto |
enumType |
Enum |
geographyType |
Geography |
int32Type |
Int32 |
Bytes
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
raw |
Use |
Raw
| JSON representation |
|---|
{ "escapeNulls": boolean } |
| Fields | |
|---|---|
escapeNulls |
If set, allows NULL values to be encoded as the empty string "". The actual empty string, or any value which only contains the null byte |
String
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
utf8Raw |
Deprecated: if set, converts to an empty |
utf8Bytes |
Use |
Utf8Bytes
| JSON representation |
|---|
{ "nullEscapeChar": string } |
| Fields | |
|---|---|
nullEscapeChar |
Single-character escape sequence used to support NULL values. If set, allows NULL values to be encoded as the empty string "". The actual empty string, or any value where every character equals If . |
Int64
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
bigEndianBytes |
Use |
orderedCodeBytes |
Use |
BigEndianBytes
| JSON representation |
|---|
{
"bytesType": {
object ( |
| Fields | |
|---|---|
bytesType |
Deprecated: ignored if set. |
Float64
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
bigEndianBytes |
Use |
Bool
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
Specifies the encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
sentinelBytes |
Required. Use |
SentinelBytes
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
trueValue |
Optional. The value to use for A base64-encoded string. |
Union field
|
|
falseValue |
Optional. The value to use for A base64-encoded string. |
Timestamp
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
unixMicrosInt64 |
Encodes the number of microseconds since the Unix epoch using the given Compatible with:
|
Aggregate
| JSON representation |
|---|
{ "inputType": { object ( |
| Fields | |
|---|---|
inputType |
Type of the inputs that are accumulated by this |
stateType |
Output only. Type that holds the internal accumulator state for the |
Union field aggregator. Which aggregator function to use. The configured types must match. aggregator can be only one of the following: |
|
sum |
Sum aggregator. |
hllppUniqueCount |
HyperLogLogPlusPlusUniqueCount aggregator. |
max |
Max aggregator. |
min |
Min aggregator. |
kllQuantiles |
KllQuantiles aggregator. |
Struct
| JSON representation |
|---|
{ "fields": [ { object ( |
| Fields | |
|---|---|
fields[] |
The names and types of the fields in this struct. |
encoding |
The encoding to use when converting to or from lower level types. |
Field
| JSON representation |
|---|
{
"fieldName": string,
"type": {
object ( |
| Fields | |
|---|---|
fieldName |
The field name (optional). Fields without a |
type |
The type of values in this field. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
singleton |
Use |
delimitedBytes |
Use |
orderedCodeBytes |
User |
DelimitedBytes
| JSON representation |
|---|
{ "delimiter": string } |
| Fields | |
|---|---|
delimiter |
Byte sequence used to delimit concatenated fields. The delimiter must contain at least 1 character and at most 50 characters. A base64-encoded string. |
Array
| JSON representation |
|---|
{
"elementType": {
object ( |
| Fields | |
|---|---|
elementType |
The type of the elements in the array. This must not be |
Map
| JSON representation |
|---|
{ "keyType": { object ( |
| Fields | |
|---|---|
keyType |
The type of a map key. Only |
valueType |
The type of the values in a map. |
Proto
| JSON representation |
|---|
{ "schemaBundleId": string, "messageName": string } |
| Fields | |
|---|---|
schemaBundleId |
The ID of the schema bundle that this proto is defined in. |
messageName |
The fully qualified name of the protobuf message, including package. In the format of "foo.bar.Message". |
Enum
| JSON representation |
|---|
{ "schemaBundleId": string, "enumName": string } |
| Fields | |
|---|---|
schemaBundleId |
The ID of the schema bundle that this enum is defined in. |
enumName |
The fully qualified name of the protobuf enum message, including package. In the format of "foo.bar.EnumMessage". |
Int32
| JSON representation |
|---|
{
"encoding": {
object ( |
| Fields | |
|---|---|
encoding |
The encoding to use when converting to or from lower level types. |
Encoding
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field encoding. Specifies which encoding to use. encoding can be only one of the following: |
|
bigEndianBytes |
Use |
orderedCodeBytes |
Use |
ArrayValue
| JSON representation |
|---|
{
"values": [
{
object ( |
| Fields | |
|---|---|
values[] |
The ordered elements in the array. |
Value
| JSON representation |
|---|
{ "partial": boolean, "type": { object ( |
| Fields | |
|---|---|
partial |
Output only. If a value is partial, it must be merged with one or more values in the right order to construct a complete value. The last partial value will have this set to |
type |
The verified Read results will never specify the encoding for When using composite types (Struct, Array, Map) only the outermost |
Union field The value is |
|
rawValue |
Represents a raw byte sequence with no type information. The A base64-encoded string. |
rawTimestampMicros |
Represents a raw cell timestamp with no type information. The |
bytesValue |
Represents a typed value transported as a byte sequence. A base64-encoded string. |
stringValue |
Represents a typed value transported as a string. |
intValue |
Represents a typed value transported as an integer. |
boolValue |
Represents a typed value transported as a boolean. |
floatValue |
Represents a typed value transported as a floating point number. Does not support NaN or infinities. |
timestampValue |
Represents a typed value transported as a timestamp. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
dateValue |
Represents a typed value transported as a date. |
arrayValue |
Represents a typed value transported as a sequence of values. To differentiate between |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
Date
| JSON representation |
|---|
{ "year": integer, "month": integer, "day": integer } |
| Fields | |
|---|---|
year |
Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. |
month |
Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. |
day |
Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌