Back to Genai Toolbox

cloud-storage-download-object

docs/en/integrations/cloud-storage/tools/cloud-storage-download-object.md

1.6.04.1 KB
Original Source

About

A cloud-storage-download-object tool streams a Cloud Storage object to a local file on the Toolbox server. Unlike cloud-storage-read-object, it does not return the object bytes to the LLM and does not require UTF-8 text content, so it can be used for binary objects or large files.

The destination path is interpreted on the server where Toolbox is running. By default, destination must be an absolute path and paths containing .. are rejected. When destination_dir is configured on the tool, destination remains visible to the LLM but must be a relative path under that configured directory. Absolute paths and paths that escape destination_dir are rejected.

Compatible Sources

{{< compatible-sources >}}

Requirements

The Cloud Storage credentials must be able to read the object. The Toolbox server process must also be able to create or overwrite the destination file. When overwrite is false, the tool returns an agent-fixable error if the destination already exists.

Parameters

parametertyperequireddescription
bucketstringtrueName of the Cloud Storage bucket containing the object.
objectstringtrueFull object name (path) within the bucket, e.g. path/to/file.txt.
destinationstringtrueAbsolute local filesystem path where the object will be written. Relative paths and paths containing .. are rejected.
overwritebooleanfalseIf true, overwrite the destination when it already exists. If false (default), return an error when it exists.

If bucket is configured on the tool, it is removed from the parameter list. If destination_dir is configured on the tool, destination stays in the parameter list but changes to a relative path under destination_dir. If overwrite is configured on the tool, it is removed from the parameter list.

Example

yaml
kind: tool
name: download_object
type: cloud-storage-download-object
source: my-gcs-source
description: Use this tool to download a Cloud Storage object to the server filesystem.
yaml
kind: tool
name: download_reports
type: cloud-storage-download-object
source: my-gcs-source
description: Use this tool to download report objects into the reports directory.
bucket: analytics-exports
destination_dir: /var/toolbox/downloads/reports
overwrite: false

Output Format

The tool returns a JSON object with:

fieldtypedescription
destinationstringLocal path where the object was written.
bytesintegerNumber of bytes written.
contentTypestringContent type recorded on the Cloud Storage object.

Reference

fieldtyperequireddescription
typestringtrueMust be "cloud-storage-download-object".
sourcestringtrueName of the Cloud Storage source to download objects from.
descriptionstringtrueDescription of the tool that is passed to the LLM.
bucketstringfalseCloud Storage bucket to use for every invocation. When set, bucket is hidden from the tool parameters.
destination_dirstringfalseAbsolute local directory to contain downloaded files. When set, destination is a relative path under this directory.
overwritebooleanfalseWhether to overwrite existing destination files for every invocation. When set, overwrite is hidden from the tool parameters.