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-object-metadata's ValidateSource fails when the bound source does not implement the tool's compatibleSource interface. Only Cloud Storage sources can back this tool; any other source type triggers this error during server startup.
Source
Thrown at internal/tools/cloudstorage/cloudstoragegetobjectmetadata/cloudstoragegetobjectmetadata.go:114
// 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 `source:` at a cloudstorage source entry.
- Remove the tool from sources that cannot support it.
- Cross-check tool-to-source bindings in the config before startup.
Example fix
# before source: my-mysql # after source: my-gcs
Defensive patterns
Strategy: validation
Validate before calling
if _, ok := src.(compatibleSource); !ok {
return fmt.Errorf("get-object-metadata requires a cloudstorage source, got %T", src)
} Type guard
func isCompatible(s sources.Source) bool { _, ok := s.(compatibleSource); return ok } Prevention
- Bind object tools only to cloudstorage sources
- Cross-check tool/source bindings during config review
- Validate full config at startup before serving
When it happens
Trigger: Type assertion `source.(compatibleSource)` fails in ValidateSource because the tool's `source` config points at a non-cloudstorage source.
Common situations: Miswired YAML binding a GCS object tool to a database source; shared config files with mismatched source names; refactors that changed source kinds.
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/7f8e714c90656c04.
Report an issue: GitHub.