{"record":{"id":"8afcc17e01b77ec8","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-8afcc1","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/tidb/tidbexecutesql/tidbexecutesql.go","lineNumber":126,"sourceCode":"\tresp, err := source.RunSQL(ctx, sqlStr, nil)\n\tif err != nil {\n\t\treturn nil, util.ProcessGeneralError(err)\n\t}\n\treturn resp, nil\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","sourceCodeStart":108,"sourceCodeEnd":130,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/tidb/tidbexecutesql/tidbexecutesql.go#L108-L130","documentation":"tidb-execute-sql's ValidateSource asserts the bound source implements compatibleSource (a TiDB/MySQL-compatible source). Binding the tool to any other source kind fails the assertion and produces this error, keeping tools and sources engine-matched.","triggerScenarios":"`tidb-execute-sql` tool's `source:` names a non-TiDB source; Invoke called directly with an incompatible sources.Source.","commonSituations":"Sharing a config across TiDB and MySQL setups and pointing at the wrong source; renaming sources during refactors.","solutions":["Point `source:` at a source with the TiDB kind.","Declare the TiDB source under `sources:` if absent.","Validate source kind per tool at startup."],"exampleFix":"# before\nsource: my-postgres\n# after\nsource: my-tidb","handlingStrategy":"type-guard","validationCode":"yq '.tools[] | select(.kind == \"tidb-execute-sql\") | .source' tools.yaml\n# verify the named source has the TiDB kind","typeGuard":"func isTiDBSource(s sources.Source) bool {\n    _, ok := s.(tidbexecutesql.CompatibleSource)\n    return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    return fmt.Errorf(\"%w (tool requires a tidb source)\", err)\n}","preventionTips":["Keep tool kind and source kind in the same YAML stanza-adjacent area for review.","Validate config at startup; fail fast on mismatch.","Grep for stale source names after refactors."],"tags":["go","config","source-binding","tidb"],"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"}