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
Identical guard to the copy-object tool: cloud-storage-createbucket.ValidateSource asserts the bound source implements compatibleSource (a Cloud Storage source). Any other source kind produces this error naming the tool type and the source name.
Source
Thrown at internal/tools/cloudstorage/cloudstoragecreatebucket/cloudstoragecreatebucket.go:117
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, ok := mapParams[bucketKey].(string)
if !ok || bucket == "" {
return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter; expected a non-empty string", bucketKey), nil)
}
project := cloudstoragecommon.ResolveString(t.Cfg.Project, mapParams, projectKey)
location := cloudstoragecommon.ResolveString(t.Cfg.Location, mapParams, locationKey)
uniformBucketLevelAccess := cloudstoragecommon.ResolveBool(t.Cfg.UniformBucketLevelAccess, mapParams, uniformBucketLevelAccessKey)
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's `source:` to a `kind: cloud-storage` source
- Verify sources.yaml declares the referenced source with the Cloud Storage kind
- Fix any renamed source references left over from refactoring
Example fix
// before
tools:
create_bucket:
source: mysql-src
// after
tools:
create_bucket:
source: gcs-src Defensive patterns
Strategy: type-guard
Validate before calling
func sourceIsGCSForCreate(s sources.Source) bool {
_, ok := s.(cloudstoragecreatebucket.CompatibleSource)
return ok
}
// before wiring: if !sourceIsGCSForCreate(src) { return errors.New("create_bucket requires a cloud-storage source") } Type guard
func asCompatibleCreateSource(s sources.Source) (compatibleSource, bool) {
cs, ok := s.(compatibleSource)
return cs, ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
return fmt.Errorf("bind create_bucket to a kind: cloud-storage source: %w", err)
} Prevention
- Map GCS-only tools exclusively to cloud-storage sources
- Verify kind fields in sources.yaml before referencing them
- Run config load in CI to surface mismatches early
- Grep for renamed/removed source names after refactors
When it happens
Trigger: A create_bucket tool entry in tools.yaml whose `source:` references a non-GCS source; passing an incompatible source instance when registering tools programmatically.
Common situations: Miswired tools.yaml after refactoring source names; reusing a generic tool template pointing at the wrong source; mixing prebuilt configs for different backends.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- description is required for tool %q
- source_bucket cannot be empty for tool %q
- destination_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/2ce87ecd5d2ad426.
Report an issue: GitHub.