Back to Genai Toolbox

cloud-storage-upload-object

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

1.2.02.8 KB
Original Source

About

A cloud-storage-upload-object tool streams a local file from the Toolbox server filesystem into a Cloud Storage object. The source path is interpreted on the server where Toolbox is running. Relative paths and paths containing .. are rejected.

When content_type is empty, Toolbox infers a MIME type from the source file extension. If inference fails, Cloud Storage detects the content type from the uploaded bytes.

Compatible Sources

{{< compatible-sources >}}

Requirements

The Cloud Storage credentials must be able to create or update the target object. The Toolbox server process must also be able to read the local source file.

Parameters

parametertyperequireddescription
bucketstringtrueName of the Cloud Storage bucket to upload into.
objectstringtrueFull object name (path) within the bucket, e.g. path/to/file.txt.
sourcestringtrueAbsolute local filesystem path of the file to upload. Relative paths and paths containing .. are rejected.
content_typestringfalseMIME type to record on the uploaded object. When empty, it is inferred from the source file extension when possible.

Example

yaml
kind: tool
name: upload_object
type: cloud-storage-upload-object
source: my-gcs-source
description: Use this tool to upload a local file to Cloud Storage.

Output Format

The tool returns a JSON object with:

fieldtypedescription
bucketstringCloud Storage bucket that received the file.
objectstringCloud Storage object name that was written.
bytesintegerNumber of bytes uploaded.
contentTypestringContent type recorded on the uploaded object.

Reference

fieldtyperequireddescription
typestringtrueMust be "cloud-storage-upload-object".
sourcestringtrueName of the Cloud Storage source to upload objects to.
descriptionstringtrueDescription of the tool that is passed to the LLM.