{"record":{"id":"2f75a2bbb32336b4","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-2f75a2","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/lookergetdashboard/lookergetdashboard.go","lineNumber":107,"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\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\tparamsMap := params.AsMap()\n\n\tdashboardId, ok := paramsMap[\"dashboard_id\"].(string)","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookergetdashboard/lookergetdashboard.go#L89-L125","documentation":"ValidateSource of looker-get-dashboard fails when the supplied sources.Source does not implement the tool's compatibleSource interface (UseClientAuthorization, GetAuthTokenHeaderName, LookerApiSettings). Only Looker sources do, so the error indicates the tool is bound to an incompatible source type.","triggerScenarios":"Server startup/registration calls ValidateSource with a non-Looker source attached to looker-get-dashboard; a test stub implementing only sources.Source is passed in.","commonSituations":"tools.yaml wiring the dashboard tool to a database source; copy-paste or renamed source entries; custom sources lacking the Looker methods; interface changes after upgrading the toolbox.","solutions":["Bind looker-get-dashboard to a Looker source (kind: looker).","Implement the complete compatibleSource interface on any custom source.","Adopt the prebuilt Looker config to avoid tool/source mismatches.","After upgrades, satisfy any newly added interface methods (the compiler reports them)."],"exampleFix":"# before\ntools:\n  dashboard:\n    kind: looker-get-dashboard\n    source: alloydb-src\n# after\nsources:\n  looker-src: { kind: looker, ... }\ntools:\n  dashboard:\n    kind: looker-get-dashboard\n    source: looker-src","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(lookergetdashboard.CompatibleSource); !ok {\n    return fmt.Errorf(\"looker-get-dashboard requires a looker source; got %T\", src)\n}","typeGuard":"func isCompatibleLooker(s sources.Source) bool {\n    _, ok := s.(interface {\n        UseClientAuthorization() bool\n        GetAuthTokenHeaderName() string\n        LookerApiSettings() *rtl.ApiSettings\n    })\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"tool/source mismatch at startup: %v\", err)\n}","preventionTips":["Pair looker-get-dashboard only with kind: looker sources.","Favor prebuilt Looker configs.","Compile-time assert custom sources against the Looker interface."],"tags":["go","looker","source-type-mismatch","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"}