{"record":{"id":"adfa05f4c5408505","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-adfa05","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/lookerdeletegitbranch/lookerdeletegitbranch.go","lineNumber":116,"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\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}\n\n\tmapParams := params.AsMap()\n\tprojectId := mapParams[\"project_id\"].(string)\n\tbranch := mapParams[\"branch\"].(string)\n\tif branch == \"\" {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerdeletegitbranch/lookerdeletegitbranch.go#L98-L134","documentation":"ValidateSource for looker-delete-gitbranch asserts the provided sources.Source against the package's compatibleSource interface (Looker SDK access plus auth methods). Sources that are not Looker sources fail the assertion and this error is returned, refusing to bind the tool to that source.","triggerScenarios":"Tool resolution at startup when the tool's `source` names a non-Looker source, or direct ValidateSource calls with an incompatible source instance.","commonSituations":"Config drift after editing sources; a tool referencing another database's source by mistake; custom sources missing GetLookerSDK or LookerApiSettings.","solutions":["Set the tool's `source` to a configured Looker source (kind: looker).","Verify source names in the config are unique and correctly referenced.","Implement the full compatibleSource interface if supplying a custom source type."],"exampleFix":"# before\nsource: my-bigquery\n\n# after\nsource: my-looker","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(interface {\n\tLookerApiSettings() *rtl.ApiSettings\n\tGetLookerSDK(context.Context, string) (*v4.LookerSDK, error)\n}); !ok {\n\treturn fmt.Errorf(\"source %T is not Looker-compatible; fix the tool's `source` field\", src)\n}","typeGuard":"func isLookerSDKSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tLookerApiSettings() *rtl.ApiSettings\n\t\tGetLookerSDK(context.Context, string) (*v4.LookerSDK, error)\n\t})\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\treturn fmt.Errorf(\"looker-delete-gitbranch bound to wrong source: %w\", err)\n}","preventionTips":["Map each Looker tool to an explicitly named looker source in the config.","Validate the merged config at startup; fail fast on source/tool mismatches.","Grep the config after renames to update all `source:` references."],"tags":["go","looker","source-validation","type-assertion","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"}