{"record":{"id":"7bb6a4f4a3678e0e","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-7bb6a4","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/postgresdatabaseoverview/postgresdatabaseoverview.go","lineNumber":130,"sourceCode":"\tresp, err := source.RunSQL(ctx, databaseOverviewStatement, 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":112,"sourceCodeEnd":134,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview.go#L112-L134","documentation":"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.","triggerScenarios":"A postgres-database-overview tool referencing a MySQL/Oracle/MongoDB or other non-Postgres source; passing an incompatible sources.Source at runtime.","commonSituations":"Template reuse across configs; switching a source's engine kind without updating dependent tools; source-name typos.","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."],"exampleFix":"# before\n  overview:\n    kind: postgres-database-overview\n    source: my-mysql\n# after\n  overview:\n    kind: postgres-database-overview\n    source: my-postgres","handlingStrategy":"type-guard","validationCode":"if err := tool.ValidateSource(src); err != nil { /* rebind source in tools.yaml */ }","typeGuard":"func isPostgresSource(s sources.Source) bool {\n    type pgSrc interface{ SourceType() string }\n    if p, ok := s.(pgSrc); ok {\n        switch p.SourceType() {\n        case \"postgres\", \"cloud-sql-postgres\", \"alloydb-postgres\", \"cloud-sql-mysql\":\n            return p.SourceType() != \"cloud-sql-mysql\"\n        }\n    }\n    return false\n}","tryCatchPattern":"if err := t.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"postgres-database-overview requires a Postgres source: %w\", err)\n}","preventionTips":["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)."],"tags":["go","postgres","source-compatibility","tool-configuration"],"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"}