googleapis/mcp-toolbox · error
destination_dir is invalid for tool %q: %w
Error message
destination_dir is invalid for tool %q: %w
What it means
The configured destination_dir failed cloudstoragecommon.ValidateLocalPath, which requires an absolute local path and rejects paths containing '..'. The underlying validation error is wrapped with %w and surfaced in this message.
Source
Thrown at internal/tools/cloudstorage/cloudstoragedownloadobject/cloudstoragedownloadobject.go:86
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)
}
if cfg.DestinationDir != nil {
if *cfg.DestinationDir == "" {
return nil, fmt.Errorf("destination_dir cannot be empty for tool %q", cfg.Name)
}
if _, err := cloudstoragecommon.ValidateLocalPath(*cfg.DestinationDir); err != nil {
return nil, fmt.Errorf("destination_dir is invalid for tool %q: %w", cfg.Name, err)
}
}
objectParam := parameters.NewStringParameter(objectKey, "Full object name (path) within the bucket, e.g. 'path/to/file.txt'.")
destinationDesc := "Absolute local filesystem path where the object will be written. Relative paths and paths containing '..' are rejected."
if cfg.DestinationDir != nil {
destinationDesc = "Relative path under the configured destination_dir where the object will be written. Absolute paths and paths that escape destination_dir are rejected."
}
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)
allParameters = append(allParameters, parameters.NewStringParameter(destinationKey, destinationDesc))
if cfg.Overwrite == nil {
allParameters = append(allParameters, parameters.NewBooleanParameter(overwriteKey, "If true, overwrite the destination when it already exists. If false (default), the tool returns an error when the destination exists.", parameters.WithBooleanDefault(false)))
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Use an absolute path without '..' for destination_dir
- Resolve the base directory at config time (e.g. use an absolute mounted volume path)
- Run cloudstoragecommon.ValidateLocalPath on your value before deploying to see the wrapped cause
Example fix
// before destination_dir: ./downloads // after destination_dir: /var/lib/toolbox/downloads
Defensive patterns
Strategy: validation
Validate before calling
if _, err := cloudstoragecommon.ValidateLocalPath(dest); err != nil {
return fmt.Errorf("invalid destination_dir: %w", err)
} Try / catch
if err := startToolbox(); err != nil {
var pathErr *fmt.wrapError
if errors.As(err, &pathErr) && strings.Contains(err.Error(), "destination_dir is invalid") {
// use absolute path without '..'
}
log.Fatal(err)
} Prevention
- Always use absolute paths
- Never include '..' segments in configured paths
- Pre-validate paths with ValidateLocalPath before deploying
When it happens
Trigger: destination_dir is relative (e.g. 'downloads' or './out') or contains a '..' traversal component (e.g. '/data/../etc') when initializing cloudstorage-download-object.
Common situations: Users entering relative paths in configs; attempting path traversal to write outside the sandbox; containers where the intended mount path differs from the configured one.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- description is required 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
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/716de00bc4f26448.
Report an issue: GitHub.