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
The postgres-database-overview tool's ValidateSource asserts the source is a Postgres-compatible source via its compatibleSource interface. A non-Postgres source bound to this tool yields this error before the overview queries execute.
Source
Thrown at internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview.go:130
resp, err := source.RunSQL(ctx, databaseOverviewStatement, sliceParams)
if err != nil {
return nil, util.ProcessGeneralError(err)
}
return resp, nil
}
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
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool at a Postgres-based source kind (postgres, cloud-sql-postgres, alloydb-postgres, etc.).
- Confirm the source name exists in the sources section and is Postgres-compatible.
- Programmatic usage: pass the Postgres source instance.
Example fix
# before
overview:
kind: postgres-database-overview
source: my-mysql
# after
overview:
kind: postgres-database-overview
source: my-postgres Defensive patterns
Strategy: type-guard
Validate before calling
if err := tool.ValidateSource(src); err != nil { /* rebind source in tools.yaml */ } Type guard
func isPostgresSource(s sources.Source) bool {
type pgSrc interface{ SourceType() string }
if p, ok := s.(pgSrc); ok {
switch p.SourceType() {
case "postgres", "cloud-sql-postgres", "alloydb-postgres", "cloud-sql-mysql":
return p.SourceType() != "cloud-sql-mysql"
}
}
return false
} Try / catch
if err := t.ValidateSource(src); err != nil {
return fmt.Errorf("postgres-database-overview requires a Postgres source: %w", err)
} Prevention
- Only bind postgres tools to Postgres-family source kinds.
- Run startup-time validation of the full config.
- Keep naming conventions that encode engine type in source names (e.g. my-postgres).
When it happens
Trigger: A postgres-database-overview tool referencing a MySQL/Oracle/MongoDB or other non-Postgres source; passing an incompatible sources.Source at runtime.
Common situations: Template reuse across configs; switching a source's engine kind without updating dependent tools; source-name typos.
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
- description is required for tool %q
- unable to execute query: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/7bb6a4f4a3678e0e.
Report an issue: GitHub.