{"record":{"id":"f1c3389b21a09220","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-f1c338","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/looker/lookerhealthvacuum/lookerhealthvacuum.go","lineNumber":122,"sourceCode":"\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\tsdk, err := source.GetLookerSDK(ctx, string(accessToken))\n\tif err != nil {\n\t\treturn nil, util.NewClientServerError(\"error getting sdk\", http.StatusInternalServerError, err)\n\t}\n\n\tparamsMap := params.AsMap()\n\ttimeframe, _ := paramsMap[\"timeframe\"].(int)\n\tif timeframe == 0 {\n\t\ttimeframe = 90","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum.go#L104-L140","documentation":"ValidateSource enforces that the source bound to the looker-health-vacuum tool implements the looker compatibleSource interface. The library throws this when the assertion source.(compatibleSource) fails, i.e., the tool was configured against a non-Looker source. Invoke would similarly fail, so this check catches the misconfiguration early.","triggerScenarios":"ValidateSource receives a sources.Source whose concrete type does not satisfy compatibleSource — typically because the tool's source: field references a non-looker source.","commonSituations":"Toolbox YAML wiring the vacuum tool to a postgres/mssql/other source by mistake; renamed or refactored looker source kinds no longer matching the interface; dynamic tool construction passing an incompatible Source implementation.","solutions":["Point the tool's source field at a source of kind looker in your config","Verify the referenced source implements compatibleSource (check its SourceType and GetAuthTokenHeaderName)","If wiring multiple sources, ensure names in the tool's source reference exactly match the looker source's declared name"],"exampleFix":"// before (toolbox.yaml)\ntools:\n  vacuum:\n    kind: looker-health-vacuum\n    source: bigquery-src\n// after\ntools:\n  vacuum:\n    kind: looker-health-vacuum\n    source: looker-src","handlingStrategy":"type-guard","validationCode":"// validate source compatibility before Invoke\nif err := tool.ValidateSource(src); err != nil {\n\treturn fmt.Errorf(\"source must be of kind looker: %w\", err)\n}","typeGuard":"func asCompatibleLookerSource(s sources.Source) (compatibleSource, bool) {\n\tcs, ok := s.(compatibleSource)\n\treturn cs, ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\treturn fmt.Errorf(\"check the tool's 'source' field points to a looker source: %w\", err)\n}","preventionTips":["Call ValidateSource during setup, before any Invoke","Match tool source references to looker-kind sources only","Add startup-time tool/source kind compatibility checks to your deployment"],"tags":["looker","type-assertion","configuration"],"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"}