{"record":{"id":"70447a2c65a58069","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-70447a","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/lookerdeleteprojectdirectory/lookerdeleteprojectdirectory.go","lineNumber":108,"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(\"error getting sdk\", http.StatusInternalServerError, err)\n\t}\n\n\tmapParams := params.AsMap()\n\tprojectId, ok := mapParams[\"project_id\"].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"'project_id' must be a string, got %T\", mapParams[\"project_id\"]), nil)","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerdeleteprojectdirectory/lookerdeleteprojectdirectory.go#L90-L126","documentation":"ValidateSource for looker-delete-projectdirectory asserts the supplied sources.Source implements compatibleSource (UseClientAuthorization, GetAuthTokenHeaderName, LookerApiSettings, GetLookerSDK). Non-Looker sources fail the assertion and this error is returned, preventing the tool from running against an incompatible source.","triggerScenarios":"Startup tool resolution or explicit ValidateSource calls when the tool's `source` names a non-Looker source or a source missing the required SDK methods.","commonSituations":"Wrong source reference in YAML; source renamed/deleted and replaced with a different kind; custom source not exposing the Looker SDK.","solutions":["Point the tool's `source` field at a configured Looker source.","Check the source's `kind` is looker and it initializes without error.","For custom sources, implement the full compatibleSource interface."],"exampleFix":"# before\nsource: redis-cache\n\n# after\nsource: my-looker","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(interface {\n\tUseClientAuthorization() bool\n\tGetAuthTokenHeaderName() string\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 isCompatibleLookerSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tUseClientAuthorization() bool\n\t\tGetAuthTokenHeaderName() string\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-projectdirectory bound to wrong source: %w\", err)\n}","preventionTips":["Reference a kind: looker source in every looker-delete-projectdirectory tool.","Validate source/tool pairings at startup; treat errors as fatal.","Re-verify bindings after any config refactor of the sources section."],"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"}