{"record":{"id":"f6ecf389f3dd7539","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-f6ecf3","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/clickhouse/clickhouselisttables/clickhouselisttables.go","lineNumber":113,"sourceCode":"\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\tdatabase, ok := mapParams[databaseKey].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"invalid or missing '%s' parameter; expected a string\", databaseKey), nil)\n\t}\n\n\t// The database name is interpolated directly into the `SHOW TABLES FROM`\n\t// statement. Reject anything that is not a plain identifier so that a\n\t// caller cannot smuggle additional clauses (LIKE, LIMIT, FORMAT,","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables.go#L95-L131","documentation":"clickhouse-list-tables.ValidateSource performs the standard compatibility check: it asserts the provided sources.Source implements `compatibleSource` and returns this error for any other source type. It ensures the tool never invokes SQL against a non-ClickHouse source.","triggerScenarios":"The tool is bound to a source that is not internal ClickHouse source type — wrong `source:` reference in the YAML config, or a test/mock source failing the assertion.","commonSituations":"Config authoring mistakes mixing source kinds; moving tool definitions between configs; upgrading the toolbox where a custom source stopped matching the interface.","solutions":["Reference a clickhouse-kind source in the tool config.","Confirm the named source exists and initialized with kind clickhouse.","Update custom sources to implement the tool's compatibleSource interface."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight check before registering\nif err := tool.ValidateSource(source); err != nil {\n    log.Fatalf(\"list-tables source mismatch: %v\", err)\n}","typeGuard":"func _, isClickhouse := src.(interface{ DB() *sql.DB }); isClickhouse","tryCatchPattern":null,"preventionTips":["Match tool type prefix (clickhouse-*) to source kind clickhouse.","Review `source:` fields when copying configs between environments.","Keep one tools file per source kind to avoid cross-wiring."],"tags":["clickhouse","source-compatibility","config","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"}