{"record":{"id":"fdb77941f3347d79","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-fdb779","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/lookeradddashboardfilter/lookeradddashboardfilter.go","lineNumber":126,"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\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, util.NewClientServerError(\"unable to get logger from ctx\", http.StatusInternalServerError, err)\n\t}\n\tlogger.DebugContext(ctx, \"params = \", params)\n\n\tparamsMap := params.AsMap()\n\tdashboard_id, ok := paramsMap[\"dashboard_id\"].(string)\n\tif !ok {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter.go#L108-L144","documentation":"ValidateSource performs an assertion that the provided sources.Source implements the compatibleSource interface (the Looker source with Client()). If it does not, the tool cannot operate on that source, so it returns this error naming the tool's configured source type.","triggerScenarios":"Binding looker-add-dashboard-filter to a source whose concrete type does not implement compatibleSource (e.g., a Postgres or non-Looker source).","commonSituations":"Copy-pasting a tool definition and pointing it at the wrong source; YAML indentation placing the tool under the wrong source; renaming a source without updating tool bindings.","solutions":["Set the tool's 'source' field to a Looker source (looker-source kind).","Check the tools.yaml so the tool is bound to the intended source name.","Confirm the source initializes as a Looker source; re-register it if the kind was wrong."],"exampleFix":"// before\ntools:\n  add-filter:\n    kind: looker-add-dashboard-filter\n    source: my-postgres\n// after\ntools:\n  add-filter:\n    kind: looker-add-dashboard-filter\n    source: my-looker\n","handlingStrategy":"validation","validationCode":"// In Go, assert compatibility before wiring the tool\nif _, ok := src.(lookercommon.CompatibleSource); !ok {\n    return fmt.Errorf(\"tool requires a looker source, got %T\", src)\n}","typeGuard":"func isCompatibleLookerSource(s sources.Source) bool {\n    _, ok := s.(compatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"source binding error: %w\", err)\n}","preventionTips":["Only bind looker-* tools to looker-source entries in tools.yaml.","Validate the full config with the toolbox before serving.","Keep tool/source naming consistent; avoid copy-paste source references."],"tags":["looker","type-mismatch","source-binding"],"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"}