{"record":{"id":"2cc0b8c1d647e386","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-2cc0b8","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/postgreslistpublicationtables/postgreslistpublicationtables.go","lineNumber":150,"sourceCode":"\tresp, err := source.RunSQL(ctx, listPublicationTablesStatement, 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":132,"sourceCodeEnd":154,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables.go#L132-L154","documentation":"The postgres-list-publication-tables tool's ValidateSource fails because the attached source does not satisfy compatibleSource (PostgresPool() *pgxpool.Pool and RunSQL). Publication tables are a Postgres-only concept, so only Postgres-family sources are accepted. Validation runs at startup when the tool is bound to its source.","triggerScenarios":"A `postgres-list-publication-tables` tool whose `source:` resolves to a non-Postgres source kind (mysql, mssql, sqlite, http, etc.) or to a missing/typo'd source name.","commonSituations":"Reusing a tool block from a Postgres config inside a MySQL/SQL Server config; source renamed in `sources:` without updating tools; wrong prebuilt config merge.","solutions":["Point `source:` at a Postgres-family source (postgres, cloud-sql-postgres, alloydb-postgres).","Check that the named source is defined and its `kind` is Postgres-based.","If using another engine, switch to that engine's equivalent tool."],"exampleFix":"# before\ntools:\n  pub-tables:\n    kind: postgres-list-publication-tables\n    source: mssql-db\n# after\ntools:\n  pub-tables:\n    kind: postgres-list-publication-tables\n    source: alloydb-pg","handlingStrategy":"validation","validationCode":"src := myConfig.sources[tool.Source]\nif _, ok := src.(interface {\n    PostgresPool() *pgxpool.Pool\n    RunSQL(context.Context, string, []any) (any, error)\n}); !ok {\n    return fmt.Errorf(\"postgres-list-publication-tables requires a Postgres-family source, got %T\", src)\n}","typeGuard":"func isCompatiblePostgresSource(s sources.Source) bool {\n    _, ok := s.(interface {\n        PostgresPool() *pgxpool.Pool\n        RunSQL(context.Context, string, []any) (any, error)\n    })\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Use publication-related tools only with Postgres-family sources.","Lint the yaml so tool kinds and source kinds stay paired.","Test configs with `toolbox` startup before committing changes."],"tags":["postgres","source-validation","config","go"],"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"}