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-sql tool's ValidateSource method when the source named in the tool's YAML config does not implement the tool's `compatibleSource` interface (a source exposing a *pgxpool.Pool and RunSQL). MCP Toolbox tools are decoupled from concrete source types, so at startup each tool type-asserts its configured source; a failed assertion means the tool was wired to a source it cannot execute SQL against.
Source
Thrown at internal/tools/postgres/postgressql/postgressql.go:131
return resp, nil
}
func (t Tool) EmbedParams(ctx context.Context, paramValues parameters.ParamValues, pMgr tools.PrimitiveManagerI) (parameters.ParamValues, error) {
return parameters.EmbedParams(ctx, t.StaticParameters, paramValues, pMgr, embeddingmodels.FormatVectorForPgvector)
}
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
- Change the tool's `source:` field to a Postgres source defined in `sources:`
- Confirm the source's kind implements PostgresPool()/RunSQL
- Validate the config locally before deploying
Example fix
# before kind: postgres-sql source: bigquery-warehouse # after kind: postgres-sql source: postgres-prod
Defensive patterns
Strategy: validation
Validate before calling
if _, ok := any(myPostgresSource).(interface {
PostgresPool() *pgxpool.Pool
RunSQL(context.Context, string, []any) (any, error)
}); !ok {
log.Fatalf("source is not compatible with postgres-sql")
} Type guard
func isCompatiblePostgresSource(s sources.Source) bool {
_, ok := s.(interface {
PostgresPool() *pgxpool.Pool
RunSQL(context.Context, string, []any) (any, error)
})
return ok
} Prevention
- Point generic postgres-sql tools only at kind: postgres sources
- Validate tools.yaml in CI with the toolbox binary
- Keep source names engine-indicative to avoid mis-wiring
- Review tools.yaml diffs for changed `source:` fields
When it happens
Trigger: Server startup/config validation when a tool of `kind: postgres-sql` references a `source:` whose registered source does not satisfy the compatibleSource interface (e.g. redis, mysql, http sources).
Common situations: Copy-pasted tool entries with stale `source:` names; pointing the generic postgres-sql tool at other database sources; typos in source names.
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/5aed13c7c733668c.
Report an issue: GitHub.