{"record":{"id":"f09422a1fb32fb42","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-f09422","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/spannerlistgraphs/spannerlistgraphs.go","lineNumber":141,"sourceCode":"\tresp, err := source.RunSQL(ctx, true, googleSQLStatement, 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// GoogleSQL statement for listing graphs\nconst googleSQLStatement = `\nWITH FilterGraphNames AS (\n  SELECT DISTINCT TRIM(name) AS GRAPH_NAME\n  FROM UNNEST(IF(@graph_names = '' OR @graph_names IS NULL, ['%'], SPLIT(@graph_names, ','))) AS name\n)\n\nSELECT\n\tPG.PROPERTY_GRAPH_SCHEMA AS schema_name,\n  PG.PROPERTY_GRAPH_NAME AS object_name,\n  CASE\n    WHEN @output_format = 'simple' THEN\n      -- IF format is 'simple', return basic JSON\n          CONCAT('{\"name\":\"', IFNULL(REPLACE(PG.PROPERTY_GRAPH_NAME, '\"', '\\\"'), ''), '\"}')","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs.go#L123-L159","documentation":"Tool.ValidateSource in spanner-list-graphs asserts the configured source implements compatibleSource (SpannerClient plus graph-supporting dialect). Non-Spanner sources fail the assertion, yielding this error at config validation time.","triggerScenarios":"Validating a spanner-list-graphs tool whose `source:` resolves to a source type that does not implement compatibleSource (e.g. a non-Spanner database source, or a Spanner source not configured for PG/GoogleSQL graph dialects).","commonSituations":"Wiring spanner-list-graphs to a plain SQL source; using the tool against a Spanner database without graph support configured; config copy-paste errors.","solutions":["Reference a Spanner source (kind spanner) with Spanner Graph support in the tool's `source:` field.","Confirm the source implements compatibleSource (SpannerClient, DatabaseDialect, RunSQL).","If using Spanner Graph, ensure the database dialect supports graphs before binding this tool."],"exampleFix":"// before\nlist-graphs:\n  kind: spanner-list-graphs\n  source: my-mysql\n// after\nlist-graphs:\n  kind: spanner-list-graphs\n  source: my-spanner-graph","handlingStrategy":"type-guard","validationCode":"if _, ok := source.(compatibleSource); !ok {\n\treturn errors.New(\"spanner-list-graphs requires a Spanner (graph-enabled) source\")\n}","typeGuard":"cs, ok := source.(compatibleSource)\nif !ok || cs.DatabaseDialect() not graph-enabled {\n\treturn errors.New(\"source must be a graph-capable Spanner source\")\n}","tryCatchPattern":null,"preventionTips":["Use spanner-list-graphs only with Spanner Graph databases.","Verify dialect/graph support on the source before binding graph tools.","Keep graph-specific tools in a separate config section for clarity."],"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"}