{"record":{"id":"1655975e8cb1103d","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-165597","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/lookergetconnections/lookergetconnections.go","lineNumber":105,"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(\"error getting sdk\", http.StatusInternalServerError, err)\n\t}","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookergetconnections/lookergetconnections.go#L87-L123","documentation":"`ValidateSource` performs a type assertion of the provided sources.Source to the tool's `compatibleSource` interface. Any source that is not a Looker source fails the assertion and produces this error, blocking tool invocation.","triggerScenarios":"Calling Tool.ValidateSource (or the Invoke path that follows it) with a source that does not implement compatibleSource — usually a mis-wired `source:` reference in the tool config.","commonSituations":"tools.yaml points the tool at a non-Looker source; server startup assigns tools to sources by name and the names were swapped; custom source implementations added without implementing compatibleSource.","solutions":["Point the tool's `source:` field at a Looker source in tools.yaml","Confirm the source kind is `looker` in the sources section of the config","If using a custom source, implement the compatibleSource methods (UseClientAuthorization, GetAuthTokenHeaderName, API client access)","Run the server and read the startup validation error to find which tool/source pair mismatched"],"exampleFix":"// before\nsources:\n  src:\n    kind: postgres\n    uri: postgres://...\ntools:\n  conns:\n    kind: looker-get-connections\n    source: src\n// after\nsources:\n  src:\n    kind: looker\n    baseUrl: https://my.looker.com\n    clientId: ...\n    clientSecret: ...\ntools:\n  conns:\n    kind: looker-get-connections\n    source: src","handlingStrategy":"type-guard","validationCode":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"tool/source mismatch: %w\", err)\n}","typeGuard":"func isLookerSource(s sources.Source) bool {\n    _, ok := s.(lookergetconnections.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(\"bind tool to a looker source, got %T\", src)\n    }\n    return err\n}","preventionTips":["Verify the `source:` value in each tool entry matches a Looker source name","Grep the tools file for looker-* tool kinds and confirm their sources' kind is `looker`","Call ValidateSource at server startup, not on first request"],"tags":["go","looker","source-binding","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"}