{"record":{"id":"0699770b0569d008","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-069977","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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/spanner/spannerlisttables/spannerlisttables.go","lineNumber":171,"sourceCode":"\tresp, err := source.RunSQL(ctx, true, statement, stmtParams)\n\tif err != nil {\n\t\treturn nil, util.ProcessGcpError(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\n// PostgreSQL statement for listing tables\nconst postgresqlStatement = `\nWITH table_info_cte AS (\n    SELECT\n      T.TABLE_SCHEMA,\n      T.TABLE_NAME,\n      T.TABLE_TYPE,\n      T.PARENT_TABLE_NAME,\n      T.ON_DELETE_ACTION\n    FROM INFORMATION_SCHEMA.TABLES AS T\n    WHERE\n      T.TABLE_SCHEMA = 'public'\n      AND T.TABLE_TYPE = 'BASE TABLE'\n      AND (","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/spanner/spannerlisttables/spannerlisttables.go#L153-L189","documentation":"Tool.ValidateSource in spanner-list-tables requires the source to implement compatibleSource (SpannerClient, DatabaseDialect, RunSQL) since the tool issues dialect-specific list-tables statements. Any other source type fails the assertion and triggers this error.","triggerScenarios":"Startup validation of a spanner-list-tables tool bound via `source:` to a non-Spanner source (postgres, mysql, bigquery, etc.).","commonSituations":"Misconfigured tools.yaml source reference; prebuilt-config reuse against the wrong engine; programmatic tool construction with a mismatched Source.","solutions":["Set the tool's `source:` to a spanner-kind source.","Audit the `sources:` block so the referenced name is the intended Spanner instance.","Pass the concrete Spanner source when constructing/validating tools in Go."],"exampleFix":"// before\nlist-tables:\n  kind: spanner-list-tables\n  source: my-postgres-source\n// after\nlist-tables:\n  kind: spanner-list-tables\n  source: my-spanner-source","handlingStrategy":"type-guard","validationCode":"if _, ok := source.(compatibleSource); !ok {\n\treturn errors.New(\"spanner-list-tables requires a Spanner source\")\n}","typeGuard":"cs, ok := source.(compatibleSource)\nif !ok { return errors.New(\"not a spanner compatibleSource\") }","tryCatchPattern":null,"preventionTips":["Point spanner-list-tables at `kind: spanner` sources only.","Run config validation as part of CI.","Use engine-prefixed source names to prevent cross-binding."],"tags":["go","spanner","config","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"}