{"record":{"id":"5801e133abbcbc57","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-5801e1","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/lookergetconnectiontables/lookergetconnectiontables.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\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\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}","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables.go#L90-L126","documentation":"ValidateSource of the looker-get-connection-tables tool returns this when the provided sources.Source does not implement its compatibleSource interface (UseClientAuthorization, GetAuthTokenHeaderName, LookerApiSettings). Only Looker sources satisfy it, so the error means the tool is attached to an incompatible source type.","triggerScenarios":"ValidateSource invoked at server startup or registration with a non-Looker source bound to this tool; a stub/test source missing one or more of the Looker interface methods.","commonSituations":"tools.yaml maps the tool to a Postgres/other source; refactors renamed sources; custom sources no longer satisfy the interface after an upgrade; test fakes implement only the base sources.Source interface.","solutions":["Bind the tool to a Looker (kind: looker) source in the config.","Implement the full compatibleSource interface on custom sources.","Use prebuilt Looker tool configs to guarantee tool/source compatibility.","Fix interface drift after upgrades by implementing newly added methods."],"exampleFix":"# before\nsource: my-bigquery-source\ntools:\n  tables: { kind: looker-get-connection-tables }\n# after\nsources:\n  my-looker: { kind: looker, ... }\ntools:\n  tables: { kind: looker-get-connection-tables, source: my-looker }","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(lookergetconnectiontables.CompatibleSource); !ok {\n    return fmt.Errorf(\"looker-get-connection-tables requires a looker source; got %T\", src)\n}","typeGuard":"func isLookerSource(s sources.Source) bool {\n    _, ok := s.(interface {\n        UseClientAuthorization() bool\n        GetAuthTokenHeaderName() string\n        LookerApiSettings() *rtl.ApiSettings\n    })\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"misconfigured tool-to-source binding: %w\", err)\n}","preventionTips":["Keep Looker tool kind and Looker source kind paired in config.","Use prebuilt configs where possible.","Add compile-time assertions: var _ compatibleSource = looker.Source{}.","Run ValidateSource at startup, not lazily at request time."],"tags":["go","looker","source-type-mismatch","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"}