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 the cloudstorage-list-objects tool's ValidateSource when the source instance passed to the tool does not implement the tool's internal compatibleSource interface. The tool only works with Cloud Storage sources; wiring it to any other source kind fails this type assertion.
Source
Thrown at internal/tools/cloudstorage/cloudstoragelistobjects/cloudstoragelistobjects.go:129
// 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)
}
prefix := cloudstoragecommon.ResolveString(t.Cfg.Prefix, mapParams, prefixKey)
delimiter := cloudstoragecommon.ResolveString(t.Cfg.Delimiter, mapParams, delimiterKey)
pageToken, _ := mapParams[pageTokenKey].(string)
maxResults, _ := mapParams[maxResultsKey].(int)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source` field at a source with kind cloud-storage
- Check that the referenced source name exists in the sources section of tools.yaml
- Rebuild/reload after fixing so ValidateSource runs against the correct source
Example fix
// before
tools:
list-objects:
kind: cloudstorage-list-objects
source: my-postgres
// after
tools:
list-objects:
kind: cloudstorage-list-objects
source: my-gcs Defensive patterns
Strategy: type-guard
Validate before calling
if _, ok := src.(sources.Source); ok {
// additionally ensure the configured source kind is cloud-storage in tools.yaml
} Type guard
func asCloudStorageSource(s sources.Source) (CompatibleSource, bool) {
cs, ok := s.(CompatibleSource)
return cs, ok
} Prevention
- Verify the tool's `source:` reference names a cloud-storage source
- Keep source names unique and greppable to avoid stale references
- Add a startup assertion/test that each tool validates against its configured source
When it happens
Trigger: A tools.yaml binds the tool to a non-cloud-storage source (e.g. a postgres source) via `source:`; or code calls ValidateSource with the wrong sources.Source implementation.
Common situations: Copy-pasting a tool definition and forgetting to change the source reference; renaming sources and pointing the tool at the wrong one; programmatically assembling tool/source pairs.
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/9e6bbb8df9334ddb.
Report an issue: GitHub.