{"record":{"id":"893a201df8690036","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-893a20","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/cloudgda/cloudgda.go","lineNumber":170,"sourceCode":"// validate interface\nvar _ tools.Tool = Tool{}\n\ntype Tool struct {\n\ttools.BaseTool[Config]\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\nfunc (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {\n\tsource, ok := s.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\tparamsMap := params.AsMap()\n\tquery, ok := paramsMap[\"query\"].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(\"query parameter not found or not a string\", nil)\n\t}\n\n\t// Parse the access token if provided\n\tvar tokenStr string\n\tif source.UseClientAuthorization() {","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudgda/cloudgda.go#L152-L188","documentation":"Tool.ValidateSource type-asserts the resolved source into the tool's compatibleSource interface and fails when the source named in the tool config does not implement it (i.e., is not a Cloud Gemini Data Analytics compatible source). This runs at config load so incompatible tool/source pairings are rejected before serving.","triggerScenarios":"Pointing a cloud-gemini-data-analytics tool at a source of a different kind (e.g. postgres, bigquery-sql) in tools.yaml.","commonSituations":"Copy-pasting a tool definition from another integration and only changing the name, not the source; renaming sources and pointing the tool at the wrong one; expecting cloudgda to work with generic SQL sources.","solutions":["Set the tool's source field to a source whose kind is a compatible Cloud Gemini Data Analytics source (e.g. cloud-gemini-data-analytics type sources)","Check the source's kind in tools.yaml matches one accepted by the cloudgda tool","Register or use a source implementing UseClientAuthorization()/the compatibleSource interface if building a custom source"],"exampleFix":"// before\ntools:\n  gda-q:\n    kind: cloud-gemini-data-analytics-query\n    source: my-postgres\n// after\ntools:\n  gda-q:\n    kind: cloud-gemini-data-analytics-query\n    source: my-gda-source","handlingStrategy":"validation","validationCode":"// check tool/source pairing before starting the server\nfunc sourceKindOK(tool map[string]any, compatibleKinds []string) bool {\n\tkind := tool[\"source_kind\"] // resolved from sources block\n\tfor _, k := range compatibleKinds { if k == kind { return true } }\n\treturn false\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair cloudgda tools only with GDA-compatible sources","Copy tool+source configs together when reusing across integrations","Validate the full tools.yaml with the server at CI time"],"tags":["config","source-validation","cloud-gemini-data-analytics"],"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"}