Tool: read_object
Reads a blob object from Cloud Storage.
Use this tool for binary files, such as images, PDFs, and zip archives.
This tool has the following constraints and behaviors:
- Size limit: The maximum supported file size is 8MiB. Requests for larger objects will fail with an
OutOfRangeerror. - Text or binary: For valid UTF-8 text files, use
read_textinstead, as it consumes fewer tokens.
The following example shows 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.
ReadObjectRequest
| JSON representation |
|---|
{ "bucketName": string, "objectName": string, "contentType": 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, |
Output schema
CallToolResponse
| JSON representation |
|---|
{ "common": { object ( |
| Fields | |
|---|---|
common |
|
content[] |
|
structuredContent |
If the tool defines an output schema, this field is 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. This field indicates that the request is incomplete. The client must try its request again with the results of these dependent requests in the 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. This field can be only one of the following values: |
|
nullValue |
Represents a null value. |
numberValue |
Represents a double value. |
stringValue |
Represents a string value. |
boolValue |
Represents a boolean value. |
structValue |
Represents a structured value. |
listValue |
Represents a repeated |
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 |
Populate exactly one of these fields. (This implementation avoids "oneof" to prevent 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 is present. (This implementation avoids "oneof" to prevent 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 } |
| Fields | |
|---|---|
title |
|
description |
|
minimum |
|
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 ] } |
| Fields | |
|---|---|
title |
|
description |
|
enumList[] |
|
enumNames[] |
|
Content
| JSON representation |
|---|
{ "text": { object ( |
| Fields | |
|---|---|
text |
Unstructured result contents. If the tool does not define an output schema, at least one of these fields is populated. If the tool defines an output schema, the Populate no more than one of these fields. (This implementation avoids "oneof" to prevent 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 |
Populate exactly one of these fields. (This implementation avoids "oneof" to prevent 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. |
Tool Annotations
Destructive hint: ❌ | Idempotent hint: ✅ | Read-only hint: ✅ | Open-world hint: ❌