{"record":{"id":"5bc5d584fa70c9cd","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-5bc5d5","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/lookercreateviewfromtable/lookercreateviewfromtable.go","lineNumber":120,"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(fmt.Sprintf(\"error getting logger from context: %s\", err), 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":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookercreateviewfromtable/lookercreateviewfromtable.go#L102-L138","documentation":"ValidateSource on the looker-createviewfromtable tool asserts that the given sources.Source implements compatibleSource. A failed assertion means the source is not a Looker source, so validation fails with this error and the tool will not invoke against it.","triggerScenarios":"Calling ValidateSource with a non-Looker source — typically because the tool's YAML source reference points at a different kind of source, or a wrong Source is passed in code.","commonSituations":"Config mistake binding the tool to a database source; test harness passing a stub source without compatibleSource methods; source kind drift after version upgrades.","solutions":["Point the tool's source field at a looker-kind source","Ensure the Looker source is registered (init) and successfully initialized","In tests/code, pass a source implementing the compatibleSource interface"],"exampleFix":"# before\nsource: my-mysql\n# after\nsource: my-looker","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(lookercreateviewfromtable.CompatibleSource); !ok {\n    return fmt.Errorf(\"looker-create-view-from-table requires a looker source\")\n}","typeGuard":"func isLookerViewSource(s sources.Source) bool {\n    _, ok := s.(lookercreateviewfromtable.CompatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    if strings.Contains(err.Error(), \"not a compatible type\") {\n        // point the tool at the looker source\n    }\n    return err\n}","preventionTips":["Cross-check tool source references against declared source kinds","Validate config at boot before tools are invoked","Use the looker source in tests for looker tools","Avoid renaming source kinds without updating tool bindings"],"tags":["go","looker","source-type-mismatch"],"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"}