Tool: read_object
Reads an object from Cloud Storage. Supports both text and binary content (it will output text for text content and binary for binary content).
Constraints & Behavior:
- Size Limit: The maximum supported file size is 8MiB. Requests for larger objects will fail with an OutOfRange error.
The following sample demonstrates how to use curl to invoke the read_object MCP tool.
| Curl Request |
|---|
curl --location 'https://storage.googleapis.com/storage/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "read_object", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for ReadObject.
ReadBlobRequest
| JSON representation |
|---|
{ "bucketName": string, "objectName": string, "contentType": string, "generation": string, "readOffset": string, "readLimit": string } |
| Fields | |
|---|---|
bucketName |
Required. Cloud Storage bucket name. |
objectName |
Required. Cloud Storage object name. |
contentType |
Optional. The IANA media type of the object (for example, |
generation |
Optional. The generation of the object to read. If omitted or set to 0, the latest generation is read. |
readOffset |
Optional. The offset from the beginning of the object at which the data should be read. If not specified, the read starts from the beginning of the object. Negative values are allowed and are interpreted as an offset from the end of the object. |
readLimit |
Optional. The maximum number of bytes to read. If not specified, the read starts from the beginning of the object and continues until the end of the object. Zero means no limit. Negative values are not allowed. |
Output Schema
CallToolResponse
| JSON representation |
|---|
{ "common": { object ( |
| Fields | |
|---|---|
common |
|
content[] |
|
structuredContent |
If the tool defines an output schema, this field will be populated. Clients that support structured output should ignore the content field above if this field is set. |
isError |
Optional. |
ResponseFields
| JSON representation |
|---|
{
"instructions": string,
"metadata": {
object
},
"dependentRequests": {
string: {
object ( |
| Fields | |
|---|---|
instructions |
Optional. Sent only on the initial response on any RPC. |
metadata |
Escape hatch for arbitrary side-channel data. |
dependentRequests |
Dependent requests. The presence of this field tells the client that the request is incomplete and that the client must try its request again with the result of these dependent requests in the dependent_responses field. An object containing a list of |
resumeData |
State for the client to echo back in subsequent RPCs for the same persistent request. |
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 |
|
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. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
DependentRequestsEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
ServerInitiatedRequest
| JSON representation |
|---|
{ "samplingCreateMessage": { object ( |
| Fields | |
|---|---|
samplingCreateMessage |
Sampling, as per https://modelcontextprotocol.io/specification/2025-03-26/client/sampling. |
listRootsRequest |
Root list request, as per https://modelcontextprotocol.io/specification/2025-03-26/client/roots. |
notifyOnRootListUpdate |
|
elicitRequest |
Elicitations, as per https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation. |
SamplingCreateMessageRequest
| JSON representation |
|---|
{ "messages": [ { object ( |
| Fields | |
|---|---|
messages[] |
|
modelPreferences |
Optional. |
systemPrompt |
Optional. |
includeContext |
Optional. |
temperature |
Optional. |
maxTokens |
Optional. |
stopSequence[] |
Optional. |
SamplingMessage
| JSON representation |
|---|
{ "role": enum ( |
| Fields | |
|---|---|
role |
Which role is sending the message. |
text |
Exactly one of these fields must be populated. (Not using "oneof", since that causes forward-compatibility problems.) |
image |
|
audio |
|
TextContent
| JSON representation |
|---|
{
"text": string,
"annotations": {
object ( |
| Fields | |
|---|---|
text |
|
annotations |
Optional. |
Annotations
| JSON representation |
|---|
{
"audience": [
enum ( |
| Fields | |
|---|---|
audience[] |
|
priority |
Must be in range [0,1]. |
ImageContent
| JSON representation |
|---|
{
"data": string,
"mimeType": string,
"annotations": {
object ( |
| Fields | |
|---|---|
data |
A base64-encoded string. |
mimeType |
|
annotations |
Optional. |
AudioContent
| JSON representation |
|---|
{
"data": string,
"mimeType": string,
"annotations": {
object ( |
| Fields | |
|---|---|
data |
A base64-encoded string. |
mimeType |
|
annotations |
Optional. |
ModelPreferences
| JSON representation |
|---|
{
"hints": [
{
object ( |
| Fields | |
|---|---|
hints[] |
|
intelligencePriority |
|
speedPriority |
|
costPriority |
|
ModelHint
| JSON representation |
|---|
{ "name": string } |
| Fields | |
|---|---|
name |
Optional. |
ElicitRequest
| JSON representation |
|---|
{
"message": string,
"requestedSchema": {
string: {
object ( |
| Fields | |
|---|---|
message |
Message to present to user. Required. |
requestedSchema |
An object containing a list of |
requiredFields[] |
|
RequestedSchemaEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
PrimitiveSchemaDefinition
| JSON representation |
|---|
{ "stringSchema": { object ( |
| Fields | |
|---|---|
stringSchema |
Exactly one of these fields will be present. (Not using "oneof", since that causes forward-compatibility problems.) |
numberSchema |
|
booleanSchema |
|
enumSchema |
|
StringSchema
| JSON representation |
|---|
{
"title": string,
"description": string,
"minLength": string,
"maxLength": string,
"format": enum ( |
| Fields | |
|---|---|
title |
|
description |
|
minLength |
|
maxLength |
|
format |
|
NumberSchema
| JSON representation |
|---|
{ "title": string, "description": string, "minimum": string, "maximum": string, "doubleRange": { object ( |
| Fields | |
|---|---|
title |
|
description |
|
minimum |
|
maximum |
|
doubleRange |
Only one of these fields must be set. |
integerRange |
|
DoubleRange
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
minimum |
|
Union field
|
|
maximum |
|
IntegerRange
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
minimum |
|
Union field
|
|
maximum |
|
BooleanSchema
| JSON representation |
|---|
{ "title": string, "description": string, "default": boolean } |
| Fields | |
|---|---|
title |
|
description |
|
default |
|
EnumSchema
| JSON representation |
|---|
{ "title": string, "description": string, "enumList": [ string ], "enumNames": [ string ], "singleSelect": { object ( |
| Fields | |
|---|---|
title |
|
description |
|
enumList[] |
|
enumNames[] |
|
singleSelect |
No more than one of these must be set. If neither is set, we assume single_select with no default value. |
multiSelect |
|
SingleSelect
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
defaultItem |
|
MultiSelect
| JSON representation |
|---|
{ "defaultItems": [ string ], // Union field |
| Fields | |
|---|---|
defaultItems[] |
|
Union field
|
|
minItems |
|
Union field
|
|
maxItems |
|
Content
| JSON representation |
|---|
{ "text": { object ( |
| Fields | |
|---|---|
text |
Unstructured result contents. At least one will be populated if the tool does not define an output schema. If the tool does define an output schema, the No more than one of these fields must be populated. (Not using "oneof", since that causes forward-compatibility problems.) |
image |
|
audio |
|
embeddedResource |
|
resourceLink |
|
EmbeddedResource
| JSON representation |
|---|
{ "contents": { object ( |
| Fields | |
|---|---|
contents |
|
annotations |
Optional. |
ResourceContents
| JSON representation |
|---|
{ "uri": string, "mimeType": string, "text": string, "blob": string } |
| Fields | |
|---|---|
uri |
|
mimeType |
|
text |
Exactly one of these fields must be populated. (Not using "oneof", since that causes forward-compatibility problems.) |
blob |
A base64-encoded string. |
Resource
| JSON representation |
|---|
{
"uri": string,
"name": string,
"title": string,
"description": string,
"mimeType": string,
"annotations": {
object ( |
| Fields | |
|---|---|
uri |
|
name |
|
title |
|
description |
Optional. |
mimeType |
Optional. |
annotations |
Optional. |
size |
Optional. |
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. |
Role
| Enums | |
|---|---|
ROLE_UNKNOWN |
|
ROLE_USER |
|
ROLE_ASSISTANT |
|
IncludeContext
| Enums | |
|---|---|
NONE |
|
THIS_SERVER |
|
ALL_SERVERS |
|
Format
| Enums | |
|---|---|
FORMAT_UNKNOWN |
|
FORMAT_EMAIL |
|
FORMAT_URI |
|
FORMAT_DATE |
|
FORMAT_DATE_TIME |
|
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌