{"record":{"id":"adab880b81a89cb4","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-adab88","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/lookergetdimensions/lookergetdimensions.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\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\tmodel, explore, err := lookercommon.ProcessFieldArgs(ctx, params)\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"error processing model or explore\", err)\n\t}\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookergetdimensions/lookergetdimensions.go#L89-L125","documentation":"ValidateSource for looker-get-dimensions performs `source.(compatibleSource)` to guarantee the bound source can serve Looker LookML queries. A non-Looker source fails the assertion and this error is returned, preventing Invoke from running against an unusable source.","triggerScenarios":"Validation or the start of Invoke when the source bound to the looker-get-dimensions tool is a non-Looker kind (Postgres, HTTP, BigQuery, etc.).","commonSituations":"tools.yaml binds the tool to the wrong source; stale references after source renames; custom Source implementations lacking the Looker interface.","solutions":["Set the tool's `source:` to a looker-kind source.","Fix source name typos so the correct source resolves.","Implement compatibleSource for custom sources.","Validate config at startup to catch the mismatch early."],"exampleFix":"// before\n    kind: looker-get-dimensions\n    source: bq-prod\n// after\n    kind: looker-get-dimensions\n    source: looker-prod","handlingStrategy":"type-guard","validationCode":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"looker-get-dimensions needs a looker source: %w\", err)\n}","typeGuard":"func isLookerSource(s sources.Source) bool {\n    _, ok := s.(compatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"source mismatch for looker tool: %v\", err)\n}","preventionTips":["Validate all tool/source bindings at server startup.","Bind looker-get-dimensions only to looker-kind sources.","Grep configs for stale source names after renames.","Implement compatibleSource fully on any custom Looker source."],"tags":["go","looker","mcp-toolbox","source-binding","type-assertion"],"backgroundTag":"incompatible-tool-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"}