{"record":{"id":"c00797b290522741","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-c00797","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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go","lineNumber":113,"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\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\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}","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go#L95-L131","documentation":"ValidateSource for looker-health-pulse asserts the given sources.Source to compatibleSource and returns this error if the assertion fails. It ensures at validation time that the tool only runs against Looker sources implementing the required interface. Non-compatible sources cannot provide the Looker API client behavior the tool needs.","triggerScenarios":"Server-side validation passes a non-Looker source, or tools.yaml binds this tool to a source of the wrong kind, so the type assertion in ValidateSource fails.","commonSituations":"Wrong source reference in tools.yaml, renamed/changed source kinds, or unit tests supplying simplified stubs that don't implement compatibleSource.","solutions":["Bind the tool to a Looker source in tools.yaml.","Ensure the source implements every method required by compatibleSource.","Reload the toolbox after correcting the configuration.","Add a regression test invoking ValidateSource with the production source type."],"exampleFix":"// before\ntool.ValidateSource(otherSource{}) // error: not compatible\n// after\nvar _ compatibleSource = looker.Source{}\ntool.ValidateSource(lookerSource)","handlingStrategy":"validation","validationCode":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"looker-health-pulse requires looker source, got %T\", src)\n}","typeGuard":"func okForPulse(s sources.Source) bool {\n    _, ok := s.(lookerhealthpulse.CompatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    if strings.Contains(err.Error(), \"not a compatible type\") {\n        return fmt.Errorf(\"check tools.yaml source binding: %w\", err)\n    }\n    return err\n}","preventionTips":["Point looker-health-pulse tools at kind: looker sources only","Run source validation as part of startup","Test with the actual source type used in production","Review YAML for typos in source names"],"tags":["go","looker","source-compatibility","type-assertion"],"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"}