Tool: list_objects
Lists the objects in a bucket.
The following code sample shows how to use curl to call the list_objects 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": "list_objects", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
ListObjectsRequest
| JSON representation |
|---|
{ "bucketName": string, "prefix": string, "recursive": boolean, "pageSize": integer, "pageToken": string } |
| Fields | |
|---|---|
bucketName |
Required. The name of the bucket to list objects in. Format: {bucket_id} |
prefix |
Optional. The prefix to filter objects by. If not specified, all objects are matched. If |
recursive |
Optional. Indicates whether the list operation should be recursive, including objects in subdirectories. If false (default), only objects directly within the specified prefix are listed. |
pageSize |
Optional. The maximum number of objects to return. The service can return fewer than this value. If unspecified, at most 1000 objects will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
pageToken |
Optional. A page token, received from a previous When paginating, all other parameters provided to |
Output Schema
Response message for ListObjects.
ListObjectsResponse
| JSON representation |
|---|
{
"objectNames": [
string
],
"prefixes": [
string
],
"nextPageToken": string,
"objects": [
{
object ( |
| Fields | |
|---|---|
objectNames[] |
The list of objects, ordered lexicographically by name. At most 1000 objects are returned. |
prefixes[] |
Object name prefixes for objects that matched the listing request but were excluded from |
nextPageToken |
A token, which can be sent as |
objects[] |
Detailed metadata for the returned objects. |
Object
| JSON representation |
|---|
{ "bucketName": string, "objectName": string, "contentType": string, "size": string, "storageClass": string, "timeCreated": string, "timeLastModified": string, "generation": string, "metageneration": string, "etag": string, "checksums": { object ( |
| Fields | |
|---|---|
bucketName |
The name of the bucket containing this object. |
objectName |
The name of this object. Nearly any sequence of unicode characters is valid. See Guidelines. |
contentType |
Content-Type of the object data, matching RFC 7231 §3.1.1.5. If an object is stored without a Content-Type, it is served as |
size |
Content-Length of the object data in bytes, matching RFC 7230 §3.3.2. |
storageClass |
Storage class of the object. |
timeCreated |
The creation time of the object. 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: |
timeLastModified |
The modification time of the object metadata. Set initially to object creation time and then updated whenever any metadata of the object changes. 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: |
generation |
The content generation of this object. Used for object versioning. |
metageneration |
The version of the metadata for this generation of this object. Used for preconditions and for detecting changes in metadata. |
etag |
The |
checksums |
Hashes for the data part of this object. |
contentEncoding |
Content-Encoding of the object data, matching RFC 7231 §3.1.2.2. |
contentDisposition |
Content-Disposition of the object data, matching RFC 6266. |
contentLanguage |
Content-Language of the object data, matching RFC 7231 §3.1.3.2. |
cacheControl |
Cache-Control directive for the object data, matching RFC 7234 §5.2. If omitted, and the object is accessible to all anonymous users, the default is |
customTime |
A user-specified timestamp set on an object. 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: |
softDeleteTime |
The time when the object became soft-deleted. 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: |
retentionExpireTime |
A server-determined value that specifies the earliest time that the object's retention period expires. 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: |
kmsKeyName |
Cloud KMS Key used to encrypt this object, if the object is encrypted by such a key. |
customerEncryption |
Metadata of customer-supplied encryption key, if the object is encrypted by such a key. |
temporaryHold |
Whether an object is under temporary hold. While this flag is set to true, the object is protected against deletion and overwrites. |
eventBasedHold |
Whether an object is under event-based hold. |
retention |
Retention configuration of this object. |
metadata |
User-provided metadata, in key/value pairs. An object containing a list of |
componentCount |
Number of underlying components that make up this object. Components are accumulated by compose operations. |
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. |
ObjectChecksumsMetadata
| JSON representation |
|---|
{ "md5Hash": string, // Union field |
| Fields | |
|---|---|
md5Hash |
A base64-encoded string. |
Union field
|
|
crc32c |
|
CustomerEncryptionMetadata
| JSON representation |
|---|
{ "encryptionAlgorithm": string, "keySha256Bytes": string } |
| Fields | |
|---|---|
encryptionAlgorithm |
|
keySha256Bytes |
A base64-encoded string. |
ObjectRetentionMetadata
| JSON representation |
|---|
{
"mode": enum ( |
| Fields | |
|---|---|
mode |
|
retainUntilTime |
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: |
MetadataEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
Mode
| Enums | |
|---|---|
MODE_UNSPECIFIED |
|
UNLOCKED |
|
LOCKED |
|
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: ❌