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
Thrown by cloudstorage-read-object ValidateSource when the source passed to the tool does not implement its compatibleSource interface. This tool requires a Cloud Storage source; any other source type fails the assertion.
Source
Thrown at internal/tools/cloudstorage/cloudstoragereadobject/cloudstoragereadobject.go:117
// validate interface
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)
}
object, ok := mapParams[objectKey].(string)
if !ok || object == "" {
return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter; expected a non-empty string", objectKey), nil)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source` at a cloud-storage kind source
- Ensure the source name exists in the sources section of tools.yaml
- Reload the server so validation runs against the corrected config
Example fix
// before
read-object:
kind: cloudstorage-read-object
source: my-alloydb
// after
read-object:
kind: cloudstorage-read-object
source: my-gcs Defensive patterns
Strategy: type-guard
Validate before calling
if kind := sourceKinds[cfg.Source]; kind != "cloud-storage" {
return fmt.Errorf("read-object needs a cloud-storage source; %q is %s", cfg.Source, kind)
} Type guard
func toCloudStorageSource(s sources.Source) (sources.Source, bool) {
if cs, ok := s.(compatibleSource); ok {
return cs, true
}
return nil, false
} Prevention
- Map each tool kind to its allowed source kinds and validate pairs at startup
- Avoid copy-pasting tool blocks without updating source
- Run `toolbox validate` style checks in CI
When it happens
Trigger: Tool config's `source:` points at a non-cloud-storage source; ValidateSource invoked with a wrong sources.Source implementation in tests or code.
Common situations: Copy-pasted tool YAML retaining another source's name; renamed sources leaving stale references; wiring tools to database sources by mistake.
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
- invalid source for %q tool: source %q is not a compatible ty
- 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/d1c50f27baa42623.
Report an issue: GitHub.