googleapis/mcp-toolbox · error
bucket cannot be empty for tool %q
Error message
bucket cannot be empty for tool %q
What it means
cloudstorage-get-object-metadata's Initialize rejects a bucket field that is a non-nil pointer to an empty string. Provide a real bucket name or omit the field entirely so bucket becomes a required parameter on the tool.
Source
Thrown at internal/tools/cloudstorage/cloudstoragegetobjectmetadata/cloudstoragegetobjectmetadata.go:76
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'.")
allParameters := parameters.Parameters{}
if cfg.Bucket == nil {
allParameters = append(allParameters, parameters.NewStringParameter(bucketKey, "Name of the Cloud Storage bucket containing the object."))
}
allParameters = append(allParameters, objectParam)
return Tool{
BaseTool: tools.NewBaseTool(
cfg,
tools.GetAnnotationsOrDefault(cfg.Annotations, tools.NewReadOnlyAnnotations),
tools.Manifest{Description: cfg.Description, Parameters: allParameters.Manifest(), AuthRequired: cfg.AuthRequired},
allParameters,
),
}, nil
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set `bucket: <real-bucket-name>` in the config.
- Omit the `bucket` key to make it a per-invocation parameter.
- Add config linting to reject empty string values for resource-name fields.
Example fix
# before bucket: "" # after bucket: my-gcs-bucket
Defensive patterns
Strategy: validation
Validate before calling
if cfg.Bucket != nil && strings.TrimSpace(*cfg.Bucket) == "" {
return errors.New("bucket cannot be empty; set a name or omit the field")
} Type guard
func bucketSet(cfg Config) bool { return cfg.Bucket != nil && *cfg.Bucket != "" } Prevention
- Never emit `bucket: ""` from generators; omit the key instead
- Verify env expansion produced non-empty values
- Add Initialize round-trip tests for each tool config
When it happens
Trigger: cfg.Bucket != nil and *cfg.Bucket == "" during Initialize — e.g. `bucket: ""` in YAML or tools.Ptr("") in Go.
Common situations: Empty string from env-var interpolation; YAML key left with no value; build-time templating leaving placeholders unresolved.
Related errors
- bucket cannot be empty for tool %q
- bucket cannot be empty for tool %q
- invalid source for %q tool: source %q is not a compatible ty
- description is required for tool %q
- description is required for tool %q
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/4674c5a6906080a2.
Report an issue: GitHub.