googleapis/mcp-toolbox · error
invalid source for %q tool: source %q is not a compatible ty
Error message
invalid source for %q tool: source %q is not a compatible type
What it means
tidb-sql's ValidateSource requires the bound source to implement compatibleSource (TiDB-compatible). Any other source type fails the interface assertion, producing this error and blocking invocation with a mismatched engine.
Source
Thrown at internal/tools/tidb/tidbsql/tidbsql.go:130
res, err := source.RunSQL(ctx, newStatement, sliceParams)
if err != nil {
return nil, util.ProcessGeneralError(err)
}
return res, nil
}
func (t Tool) GetSourceName() string {
return t.Cfg.Source
}
func (t Tool) ToConfig() tools.ToolConfig {
return t.Cfg
}
func (t Tool) ValidateSource(source sources.Source) error {
_, ok := source.(compatibleSource)
if !ok {
return fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", t.Cfg.Type, t.Cfg.Source)
}
return nil
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set `source:` to a TiDB-kind source name.
- Add the missing TiDB source declaration.
- Run a config lint that checks tool kind vs source kind pairs.
Example fix
# before source: spanner-prod # after source: tidb-prod
Defensive patterns
Strategy: type-guard
Validate before calling
# check each tidb-sql tool's source kind is TiDB yq '.tools[] | select(.kind == "tidb-sql") | .source' tools.yaml
Type guard
func isTiDBSource(s sources.Source) bool {
_, ok := s.(tidbsql.CompatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
log.Fatalf("bad source binding for tidb-sql: %v", err)
} Prevention
- Pair tool definitions with their sources in per-engine config files.
- Run startup validation before serving traffic.
- Keep source names unique across engines to avoid wrong bindings.
When it happens
Trigger: `tidb-sql` tool bound to a non-TiDB source via `source:`; direct Go call passing an incompatible source.
Common situations: Multi-database configs where tool/source names were swapped; refactors that renamed sources without updating tool bindings.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/10bf1cd9dac15a09.
Report an issue: GitHub.