{"record":{"id":"5aed13c7c733668c","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-5aed13","errorCode":null,"errorMessage":"invalid source for %q tool: source %q is not a compatible type","messagePattern":"invalid source for %q tool: source %q is not a compatible type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/postgres/postgressql/postgressql.go","lineNumber":131,"sourceCode":"\treturn resp, nil\n}\n\nfunc (t Tool) EmbedParams(ctx context.Context, paramValues parameters.ParamValues, pMgr tools.PrimitiveManagerI) (parameters.ParamValues, error) {\n\treturn parameters.EmbedParams(ctx, t.StaticParameters, paramValues, pMgr, embeddingmodels.FormatVectorForPgvector)\n}\n\nfunc (t Tool) GetSourceName() string {\n\treturn t.Cfg.Source\n}\n\nfunc (t Tool) ToConfig() tools.ToolConfig {\n\treturn t.Cfg\n}\n\nfunc (t Tool) ValidateSource(source sources.Source) error {\n\t_, ok := source.(compatibleSource)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid source for %q tool: source %q is not a compatible type\", t.Cfg.Type, t.Cfg.Source)\n\t}\n\treturn nil\n}\n","sourceCodeStart":113,"sourceCodeEnd":135,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgressql/postgressql.go#L113-L135","documentation":"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.","triggerScenarios":"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).","commonSituations":"Copy-pasted tool entries with stale `source:` names; pointing the generic postgres-sql tool at other database sources; typos in source names.","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"],"exampleFix":"# before\nkind: postgres-sql\nsource: bigquery-warehouse\n# after\nkind: postgres-sql\nsource: postgres-prod","handlingStrategy":"validation","validationCode":"if _, ok := any(myPostgresSource).(interface {\n\tPostgresPool() *pgxpool.Pool\n\tRunSQL(context.Context, string, []any) (any, error)\n}); !ok {\n\tlog.Fatalf(\"source is not compatible with postgres-sql\")\n}","typeGuard":"func isCompatiblePostgresSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tPostgresPool() *pgxpool.Pool\n\t\tRunSQL(context.Context, string, []any) (any, error)\n\t})\n\treturn ok\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["go","config","postgres","source-validation"],"backgroundTag":"incompatible-source-type","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}