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
cloudsqlpg-create-instances accepts only Cloud SQL Postgres sources. ValidateSource type-asserts the bound sources.Source to compatibleSource and returns this error when the source is of any other kind, preventing the tool from invoking against an incompatible source.
Source
Thrown at internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances.go:102
}
// Tool represents the create-instances 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
}
// Invoke executes the tool's logic.
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)
}
paramsMap := params.AsMap()
project, ok := paramsMap["project"].(string)
if !ok {
return nil, util.NewAgentError("missing 'project' parameter", nil)
}
name, ok := paramsMap["name"].(string)
if !ok {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool at a `cloud-sql-postgres` source in the config
- Confirm the referenced source exists and is of the right kind (`toolbox --tools`)
- Use a generic run-sql tool instead if instance management isn't needed
Example fix
// before source: my-postgres # kind: postgres // after source: my-cloudsql-pg # kind: cloud-sql-postgres
Defensive patterns
Strategy: validation
Validate before calling
if err := tool.ValidateSource(cfg.Sources[tool.Source]); err != nil { return fmt.Errorf("tool %q misconfigured: %w", tool.Name, err) } Type guard
func isCloudSQLPgSource(s sources.Source) bool { _, ok := s.(interface{ GetDefaultProject() string }); return ok } Try / catch
if err := tool.ValidateSource(src); err != nil {
// fail config load; do not retry — this is a static config problem
return err
} Prevention
- Never point Cloud SQL admin tools at vanilla database sources
- Diff tool/source kind pairings when upgrading toolbox versions
When it happens
Trigger: Tool initialization with `source.(compatibleSource)` failing — tool's `source` points at a non-cloud-sql-postgres source (plain `postgres`, `alloydb`, etc.).
Common situations: Reusing an alloydb or vanilla postgres source for instance creation; renaming sources and leaving stale references; prebuilt-config users overriding `source` incorrectly.
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/ad26ee4fb5e20207.
Report an issue: GitHub.