cloudstoragecommon

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cloudstoragecommon holds helpers shared across the Cloud Storage tool implementations, chiefly error classification.

Index

Constants

This section is empty.

Variables

View Source
var ErrBinaryContent = errors.New("cloud storage object is not valid UTF-8 text")

ErrBinaryContent is returned by the source when an object's bytes are not valid UTF-8. The MCP tool result channel only carries text today, so binary payloads cannot be faithfully round-tripped; ProcessGCSError maps this to an Agent error so the LLM knows to stop asking for this object.

TODO: when the toolbox supports non-text MCP content (embedded resources, images, blobs), remove this guard and return binary payloads directly.

View Source
var ErrDestinationExists = errors.New("download destination already exists")

ErrDestinationExists is returned by the download_object source method when the local destination file already exists and overwrite is false. ProcessGCSError maps this to an Agent error so the LLM can retry the call with overwrite=true.

View Source
var ErrReadSizeLimitExceeded = errors.New("cloud storage read size limit exceeded")

ErrReadSizeLimitExceeded is returned by the source when an object/range would exceed the source's configured byte limit. ProcessGCSError maps this to an Agent error because the LLM can fix the call by narrowing the 'range' parameter.

Functions

func ProcessGCSError

func ProcessGCSError(err error) util.ToolboxError

ProcessGCSError classifies an error from the Cloud Storage Go client into either an Agent Error (the LLM can self-correct by changing its input — bad request, missing bucket/object, unsatisfiable range) or a Server Error (infrastructure failure — auth, IAM denial, quota, 5xx, network cancellation). See DEVELOPER.md "Tool Invocation & Error Handling" for the wider rationale.

func ValidateLocalPath

func ValidateLocalPath(p string) (string, error)

ValidateLocalPath enforces the local-filesystem path contract used by download_object and upload_object: non-empty, absolute after filepath.Clean, and free of ".." components. It returns the cleaned path. OS permissions remain the real isolation boundary; this check just prevents obvious traversal mistakes and forces callers to be explicit about where they want bytes to land.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL