googleapis/mcp-toolbox · error

bucket cannot be empty for tool %q

Error message

bucket cannot be empty for tool %q

What it means

Configuration-time validation in Initialize: the upload tool's optional bucket override is present in tools.yaml but set to an empty string, leaving the tool with no usable bucket default.

Source

Thrown at internal/tools/cloudstorage/cloudstorageuploadobject/cloudstorageuploadobject.go:77

	Type             string                 `yaml:"type" validate:"required"`
	Source           string                 `yaml:"source" validate:"required"`
	Annotations      *tools.ToolAnnotations `yaml:"annotations,omitempty"`
	Bucket           *string                `yaml:"bucket,omitempty"`
}

// validate interface
var _ tools.ToolConfig = Config{}

func (cfg Config) ToolConfigType() string {
	return resourceType
}

func (cfg Config) Initialize(context.Context) (tools.Tool, error) {
	if cfg.Description == "" {
		return nil, fmt.Errorf("description is required for tool %q", cfg.Name)
	}
	if cfg.Bucket != nil && *cfg.Bucket == "" {
		return nil, fmt.Errorf("bucket cannot be empty for tool %q", cfg.Name)
	}

	objectParam := parameters.NewStringParameter(objectKey, "Full object name (path) within the bucket, e.g. 'path/to/file.txt'.")
	sourceParam := parameters.NewStringParameter(sourceKey, "Absolute local filesystem path of the file to upload. Relative paths and paths containing '..' are rejected.")
	contentTypeParam := parameters.NewStringParameter(contentTypeKey, "MIME type to record on the uploaded object. When empty, it is inferred from the source file's extension; if that fails, Cloud Storage auto-detects from the first 512 bytes of content.", parameters.WithStringDefault(""))
	allParameters := parameters.Parameters{}
	if cfg.Bucket == nil {
		allParameters = append(allParameters, parameters.NewStringParameter(bucketKey, "Name of the Cloud Storage bucket to upload into."))
	}
	allParameters = append(allParameters, objectParam, sourceParam, contentTypeParam)

	return Tool{
		BaseTool: tools.NewBaseTool(
			cfg,
			tools.GetAnnotationsOrDefault(cfg.Annotations, tools.NewDestructiveAnnotations),
			tools.Manifest{Description: cfg.Description, Parameters: allParameters.Manifest(), AuthRequired: cfg.AuthRequired},
			allParameters,
		),

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set bucket to a real bucket name in the tool configuration
  2. Remove the bucket key entirely if the bucket will be supplied per invocation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/tools/cloudstorage/cloudstorageuploadobject/cloudstorageuploadobject.go:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/0588c9e8f7844074. Report an issue: GitHub.