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
The cloudstorage-get-bucket-iam-policy tool only works with sources that implement its compatibleSource interface (a Cloud Storage source). ValidateSource is called at server startup when binding a tool to a source; if the configured source is of a different type (e.g. a Postgres source), this error is returned. It catches YAML mistakes where a tool references the wrong source name.
Source
Thrown at internal/tools/cloudstorage/cloudstoragegetbucketiampolicy/cloudstoragegetbucketiampolicy.go:106
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)
}
resp, err := source.GetBucketIAMPolicy(ctx, bucket)
if err != nil {
return nil, cloudstoragecommon.ProcessGCSError(err)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source` field at a cloudstorage source defined in the `sources` section.
- Remove the tool if it was added to the wrong source's toolset.
- Check the source name spelling against the keys under `sources:` in the config.
Example fix
# before
tools:
get_bucket_iam_policy:
kind: cloudstorage-get-bucket-iam-policy
source: my-postgres
# after
tools:
get_bucket_iam_policy:
kind: cloudstorage-get-bucket-iam-policy
source: my-gcs-source Defensive patterns
Strategy: validation
Validate before calling
if _, ok := src.(cloudstorage.CompatibleSource); !ok {
return fmt.Errorf("tool %s requires a cloudstorage source", toolName)
} Type guard
func isCompatible(s sources.Source) bool { _, ok := s.(compatibleSource); return ok } Prevention
- Keep tools nested under the matching source's tools list in YAML
- Verify source kind fields when copying configs between projects
- Start the server early in CI to surface ValidateSource errors
When it happens
Trigger: A tool config's `source` field names a source whose Go type does not implement the tool's compatibleSource interface — checked during ValidateSource at startup.
Common situations: Copy-pasted tool configs referencing the wrong source; renaming sources in YAML without updating tool bindings; mixing cloudstorage tools with database sources.
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
- bucket cannot be empty for tool %q
- invalid source for %q tool: source %q is not a compatible ty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/ee597bff4c714a81.
Report an issue: GitHub.