{"record":{"id":"1f3780759e21bb14","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-1f3780","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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/redis/redis.go","lineNumber":99,"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\tcmds, err := replaceCommandsParams(t.Cfg.Commands, t.Cfg.Parameters, params)\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"error replacing commands' parameters\", err)\n\t}\n\tresp, err := source.RunCommand(ctx, cmds)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)\n\t}\n\treturn resp, nil","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/redis/redis.go#L81-L117","documentation":"This error is thrown by the redis tool's ValidateSource method when the source named in the tool's YAML config does not implement the tool's `compatibleSource` interface (a source exposing a RedisClient and RunCommand). MCP Toolbox tools are decoupled from concrete source types, so at startup each tool type-asserts its configured source; a failed assertion means the tool was wired to a source it cannot send Redis commands to.","triggerScenarios":"Server startup/config validation when a tool of `kind: redis` references a `source:` whose registered source does not satisfy the compatibleSource interface (e.g. postgres, mysql, http sources).","commonSituations":"Copy-pasted tool entries with stale `source:` names; pointing the redis tool at a non-Redis source; renaming sources without updating tool references.","solutions":["Change the tool's `source:` field to a Redis source (kind: redis) defined in `sources:`","Confirm the source implements RedisClient()/RunCommand","Validate the config locally before deploying"],"exampleFix":"# before\nkind: redis\nsource: postgres-prod\n# after\nkind: redis\nsource: redis-cache","handlingStrategy":"validation","validationCode":"if _, ok := any(myRedisSource).(interface {\n\tRedisClient() redissrc.RedisClient\n\tRunCommand(context.Context, [][]any) (any, error)\n}); !ok {\n\tlog.Fatalf(\"source is not compatible with redis tools\")\n}","typeGuard":"func isCompatibleRedisSource(s sources.Source) bool {\n\t_, ok := s.(interface {\n\t\tRedisClient() redissrc.RedisClient\n\t\tRunCommand(context.Context, [][]any) (any, error)\n\t})\n\treturn ok\n}","tryCatchPattern":null,"preventionTips":["Point kind: redis tools only at Redis sources (kind: redis)","Validate tools.yaml in CI with the toolbox binary","Keep engine-indicative source names (redis-cache, not generic 'db')","Avoid copy-pasting tool blocks across engines without updating `source:`"],"tags":["go","config","redis","source-validation"],"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"}