{"record":{"id":"e3f9a400b6d31717","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-e3f9a4","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/lookergetprojectfiles/lookergetprojectfiles.go","lineNumber":106,"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\n\tsdk, err := source.GetLookerSDK(ctx, string(accessToken))\n\tif err != nil {\n\t\treturn nil, util.NewClientServerError(fmt.Sprintf(\"error getting sdk: %v\", err), http.StatusInternalServerError, err)\n\t}","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles.go#L88-L124","documentation":"ValidateSource on the looker-get-project-files tool asserts the provided sources.Source to its compatibleSource interface. Any source that is not the Looker API source fails the assertion and produces this error, preventing the tool from being used with that source. Same family as the other Looker tool source-mismatch errors.","triggerScenarios":"ValidateSource is called (at toolset build, server startup, or per-invocation checks) with a source bound to a looker-get-project-files tool that does not implement compatibleSource, e.g. a postgres or http source.","commonSituations":"tools.yaml tool entries pointing at the wrong source name; renamed or replaced sources; sharing one toolset definition across projects where source kinds differ.","solutions":["Set the tool's `source:` field to a source of kind `looker` in your configuration.","Cross-check every looker-* tool entry: each must reference the same Looker source (or another Looker-kind source).","Restart the server and confirm no ValidateSource errors appear at startup."],"exampleFix":"// before\ntool:\n  kind: looker-get-project-files\n  source: warehouse  # not a looker source\n// after\ntool:\n  kind: looker-get-project-files\n  source: my-looker","handlingStrategy":"type-guard","validationCode":"// Fail fast when a looker tool is bound to a non-looker source\nfor name, toolCfg := range cfg.Tools {\n    if strings.HasPrefix(toolCfg.Kind, \"looker-\") {\n        if cfg.Sources[toolCfg.Source].GetSourceConfigType() != \"looker\" {\n            return fmt.Errorf(\"tool %q (%s) must bind to a looker source\", name, toolCfg.Kind)\n        }\n    }\n}","typeGuard":"func isLookerSource(s sources.Source) bool {\n    _, ok := s.(interface {\n        UseClientAuthorization() bool\n        GetAuthTokenHeaderName() string\n    })\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"fix 'source:' binding for looker-get-project-files (must be kind: looker): %w\", err)\n}","preventionTips":["Group looker tools under a single source reference and copy it consistently.","Rename sources and tools together in one commit to avoid drift.","Add startup validation of every tool/source pair."],"tags":["go","looker","config","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"}