googleapis/mcp-toolbox · error
invalid source for %q tool: source %q is not a compatible ty
Error message
invalid source for %q tool: source %q is not a compatible type
What it means
cloudstorage-get-bucket-metadata's ValidateSource rejects any source not implementing its compatibleSource interface. The tool can only be bound to a Cloud Storage source; binding it to any other source type fails at startup with this message naming the tool and configured source.
Source
Thrown at internal/tools/cloudstorage/cloudstoragegetbucketmetadata/cloudstoragegetbucketmetadata.go:107
var _ tools.Tool = Tool{}
type Tool struct {
tools.BaseTool[Config]
}
func (t Tool) GetSourceName() string {
return t.Cfg.Source
}
func (t Tool) ToConfig() tools.ToolConfig {
return t.Cfg
}
func (t Tool) ValidateSource(source sources.Source) error {
_, ok := source.(compatibleSource)
if !ok {
return fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", t.Cfg.Type, t.Cfg.Source)
}
return nil
}
func (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {
source, ok := s.(compatibleSource)
if !ok {
return nil, util.NewClientServerError("source used is not compatible with the tool", http.StatusInternalServerError, nil)
}
mapParams := params.AsMap()
bucket := cloudstoragecommon.ResolveString(t.Cfg.Bucket, mapParams, bucketKey)
if bucket == "" {
return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter; expected a non-empty string", bucketKey), nil)
}
attrs, err := source.GetBucketMetadata(ctx, bucket)
if err != nil {
return nil, cloudstoragecommon.ProcessGCSError(err)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Bind the tool to a cloudstorage source (the `source:` value must match a cloudstorage entry in `sources:`).
- Delete or move the tool to the correct source's toolset.
- Verify source key spelling in the YAML.
Example fix
# before source: alloydb-source # after source: gcs-source
Defensive patterns
Strategy: validation
Validate before calling
if _, ok := src.(compatibleSource); !ok {
return fmt.Errorf("get-bucket-metadata requires a cloudstorage source, got %T", src)
} Type guard
func isCompatible(s sources.Source) bool { _, ok := s.(compatibleSource); return ok } Prevention
- Match each tool kind to its source kind in config review
- Rename sources with search-and-replace across the whole config
- Run toolbox startup validation in CI
When it happens
Trigger: Tool config `source` references a source whose Go type fails the `source.(compatibleSource)` type assertion during ValidateSource.
Common situations: Tool defined under the wrong source in YAML; refactoring source names; reusing a generic tools.yaml across projects with different sources.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- bucket cannot be empty 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/f21797282dfc757f.
Report an issue: GitHub.