{"record":{"id":"688ca2794d8b4703","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-688ca2","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/lookerupdateagent/lookerupdateagent.go","lineNumber":126,"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":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerupdateagent/lookerupdateagent.go#L108-L144","documentation":"ValidateSource checks that the source passed to the looker-update-agent tool implements its compatibleSource interface. A failed type assertion means the bound source is not a Looker source, so Invoke could never safely call Looker APIs; the error short-circuits with a formatted message naming the tool config type and source name.","triggerScenarios":"Tool.ValidateSource is called during server init (tool-source binding validation) or pre-invoke, with a source that is not the Looker source implementation — typically a misnamed `source:` reference in the tool config.","commonSituations":"Tool bound to a wrong-kind source (e.g. postgres, http) in tools.yaml; source renamed/removed so binding resolution picks an incorrect source; wiring tools programmatically with the wrong sources.Source instance.","solutions":["Set the tool's `source` to the Looker source name in your config","Check startup logs to confirm the referenced source initialized as kind looker","If composing programmatically, pass the correct sources.Source (looker source) to ValidateSource"],"exampleFix":"// before\ntools:\n  update_agent:\n    kind: looker-update-agent\n    source: my-bigquery-source\n// after\ntools:\n  update_agent:\n    kind: looker-update-agent\n    source: my-looker-source","handlingStrategy":"type-guard","validationCode":"if err := tool.ValidateSource(lookerSource); err != nil {\n    return fmt.Errorf(\"bind check failed: %w\", err)\n}","typeGuard":"func isCompatibleSource(s sources.Source) bool {\n    _, ok := s.(lookercommon.CompatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    if strings.Contains(err.Error(), \"not a compatible type\") {\n        // fix the tool's source binding, then retry\n    }\n    return err\n}","preventionTips":["Verify the source kind in tools.yaml matches the tool family (looker tools need looker sources)","Avoid renaming sources referenced by tools without updating all bindings","Add an integration test that validates every tool/source pair at boot"],"tags":["go","looker","type-assertion","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"}