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
This error is thrown by the postgres-list-locks tool's ValidateSource when the source attached to the tool does not implement the compatibleSource interface (PostgresPool() *pgxpool.Pool and RunSQL(context.Context, string, []any) (any, error)). Toolbox validates every tool/source pairing at startup so failures surface early instead of at invocation time. It means the tool is wired to a source kind (e.g. mysql, http) that cannot serve Postgres queries.
Source
Thrown at internal/tools/postgres/postgreslistlocks/postgreslistlocks.go:139
resp, err := source.RunSQL(ctx, listLocks, 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's `source:` field at a source whose kind is postgres, cloud-sql-postgres, alloydb-postgres, or another Postgres-family source (PostgresPool/RunSQL implementer).
- Confirm the referenced source is defined in the `sources:` section and its `kind` is a Postgres type.
- If you intended a different database, use the equivalent tool for that source (e.g. mysql-list-tables) instead of the postgres tool.
- Regenerate from the matching prebuilt config (e.g. postgres prebuilt.yaml) rather than hand-editing cross-source.
Example fix
# before
sources:
my-db:
kind: mysql
...
tools:
list-locks:
kind: postgres-list-locks
source: my-db
# after
sources:
my-db:
kind: postgres
...
tools:
list-locks:
kind: postgres-list-locks
source: my-db Defensive patterns
Strategy: validation
Validate before calling
kind, _ := myConfig.sources[tool.Source].(sources.Source)
pgSrc, ok := kind.(interface {
PostgresPool() *pgxpool.Pool
RunSQL(context.Context, string, []any) (any, error)
})
if !ok {
return fmt.Errorf("source %q for tool %q must be a Postgres-family source", tool.Source, tool.Kind)
} Type guard
func isCompatiblePostgresSource(s sources.Source) bool {
_, ok := s.(interface {
PostgresPool() *pgxpool.Pool
RunSQL(context.Context, string, []any) (any, error)
})
return ok
} Prevention
- Keep each tool's `source:` pointing at a source of the matching engine family (postgres tools -> postgres kinds).
- Validate the toolbox yaml with `toolbox --prebuilt postgres` templates or a startup smoke test before deploying.
- Never share a single tools block across mysql/postgres configs; generate per-engine configs.
- Add a CI check that parses the yaml and asserts source kinds against tool kinds.
When it happens
Trigger: Running `toolbox` (or AddTool/GetTool resolution) with a tools yaml where a `postgres-list-locks` tool references a `source:` whose registered source type does not satisfy compatibleSource — e.g. source kind mysql, mssql, cloud-sql-mysql, alloydb-mysql, sqlite, or any non-Postgres source.
Common situations: Copy-pasting a tool definition into a different source's config without changing `source:`; typo'd or unregistered `sourceKind` falling back to the wrong source; using cloud-sql-mysql with postgres tools; prebuilt config mixing when hand-editing.
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/4cf2baa7239da57b.
Report an issue: GitHub.