{"record":{"id":"50f9dd802658a7fd","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-50f9dd","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/postgreslistviews/postgreslistviews.go","lineNumber":141,"sourceCode":"\tresp, err := source.RunSQL(ctx, listViewsStatement, sliceParams)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)\n\t}\n\treturn resp, nil\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":123,"sourceCodeEnd":145,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgreslistviews/postgreslistviews.go#L123-L145","documentation":"This error is thrown by the postgres-list-views tool's ValidateSource method when the source named in the tool's YAML config does not implement the tool's `compatibleSource` interface (a Postgres-backed source exposing a pgx pool). 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 use.","triggerScenarios":"Server startup/config validation when a tool of `kind: postgres-list-views` 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 Postgres tools at non-Postgres sources; typos in the source name resolving to a differently-typed source.","solutions":["Change the tool's `source:` field to a Postgres source defined in `sources:`","Confirm the source's kind implements PostgresPool()/the required methods","Validate the config locally before deploying"],"exampleFix":"# before\nkind: postgres-list-views\nsource: http-api\n# after\nkind: postgres-list-views\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-list-views\")\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":["Match tool kind prefix to source kind (postgres-* -> kind: postgres)","Validate tools.yaml in CI with the toolbox binary","Use distinct, engine-indicating source names (e.g. postgres-prod vs mysql-prod)","Avoid copy-paste edits without updating `source:`"],"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"}