{"record":{"id":"184234048d7fc752","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-184234","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/postgreslisttables/postgreslisttables.go","lineNumber":204,"sourceCode":"\tresSlice, ok := resp.([]any)\n\tif !ok || len(resSlice) == 0 {\n\t\treturn []any{}, nil\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":186,"sourceCodeEnd":208,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgreslisttables/postgreslisttables.go#L186-L208","documentation":"The postgres-list-tables tool's ValidateSource fails because the attached source does not implement compatibleSource (PostgresPool() *pgxpool.Pool and RunSQL). Only Postgres-family sources can back this tool, since it queries Postgres catalogs through the pgx pool. Validation occurs at startup when the tool is bound to its named source.","triggerScenarios":"A `postgres-list-tables` tool whose `source:` points to a non-Postgres source kind (mysql, mssql, sqlite, http, etc.) or to a nonexistent/misspelled source name.","commonSituations":"Cross-engine copy-paste of tool configs; renamed sources not updated in tools; mixing cloud-sql-mysql sources with postgres tools; typo'd prebuilt-config merges.","solutions":["Point `source:` at a Postgres-family source (postgres, cloud-sql-postgres, alloydb-postgres).","Verify the source is defined in `sources:` with a Postgres `kind`.","Use the engine-appropriate equivalent tool if the source is not Postgres.","Regenerate from the matching prebuilt config instead of manual edits."],"exampleFix":"# before\ntools:\n  list-tables:\n    kind: postgres-list-tables\n    source: mysql-app\n# after\ntools:\n  list-tables:\n    kind: postgres-list-tables\n    source: pg-app","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-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":["Pair postgres-list-tables only with postgres/cloud-sql-postgres/alloydb-postgres sources.","Avoid copy-pasting tool blocks across engine configs; generate per-engine configs.","Run `toolbox` startup validation in CI to catch mismatches early.","Grep for stale source names after renaming sources."],"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"}