{"record":{"id":"79fbbdf9964f8341","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-79fbbd","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/lookergetconnectionschemas/lookergetconnectionschemas.go","lineNumber":107,"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\tmapParams := params.AsMap()\n\tconn, ok := mapParams[\"conn\"].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"'conn' must be a string, got %T\", mapParams[\"conn\"]), nil)\n\t}\n\tdb, _ := mapParams[\"db\"].(string)\n\n\tsdk, err := source.GetLookerSDK(ctx, string(accessToken))\n\tif err != nil {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas.go#L89-L125","documentation":"ValidateSource type-asserts the resolved source against the tool's compatibleSource interface (Looker API access). The error fires when the tool is bound to a source that is not a Looker source, i.e. the tool kind and source kind in the YAML configuration are incompatible.","triggerScenarios":"ValidateSource (or the subsequent Invoke) receives a non-Looker source, e.g. because the tools.yaml `source:` field names a source of another kind.","commonSituations":"Wrong source name in the tool config; renamed sources leaving stale references; custom sources missing compatibleSource methods; passing mocks in tests.","solutions":["Set the tool's `source:` to a Looker source (kind `looker`)","Implement compatibleSource if a custom source must work with Looker tools","Cross-check tool-to-source mappings in the config after any rename/refactor"],"exampleFix":"// before\ntools:\n  schemas:\n    kind: looker-get-connection-schemas\n    source: bq-src\n// after\ntools:\n  schemas:\n    kind: looker-get-connection-schemas\n    source: looker-src","handlingStrategy":"type-guard","validationCode":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"source %T incompatible with looker-get-connection-schemas\", src)\n}","typeGuard":"func isCompatibleLookerSource(s sources.Source) bool {\n    _, ok := s.(lookergetconnectionschemas.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 errors.New(\"bind this tool to a looker source\")\n    }\n    return err\n}","preventionTips":["Validate tool/source pairing at startup","Search tools.yaml for looker tool kinds and audit their sources","Update stale source references after renames"],"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"}