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
sqlite-sql's ValidateSource performs the same interface assertion: the source must implement compatibleSource (SQLite-backed). A tool bound to a non-SQLite source (or any unrelated sources.Source) fails the assertion and this error is returned before Invoke runs.
Source
Thrown at internal/tools/sqlite/sqlitesql/sqlitesql.go:106
// validate interface
var _ tools.Tool = Tool{}
type Tool struct {
tools.BaseTool[Config]
}
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
}
func (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {
source, ok := s.(compatibleSource)
if !ok {
return nil, util.NewClientServerError("source used is not compatible with the tool", http.StatusInternalServerError, nil)
}
paramsMap := params.AsMap()
newStatement, err := parameters.ResolveTemplateParams(t.Cfg.TemplateParameters, t.Cfg.Statement, paramsMap)
if err != nil {
return nil, util.NewAgentError("unable to extract template params", err)
}
newParams, err := parameters.GetParams(t.Cfg.Parameters, paramsMap)
if err != nil {
return nil, util.NewAgentError("unable to extract standard params", err)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's `source:` to a `kind: sqlite` source.
- Create the sqlite source if missing.
- Add automated cross-checks between tool kinds and source kinds.
Example fix
# before source: cloud-sql-pg # after source: local-sqlite
Defensive patterns
Strategy: type-guard
Validate before calling
# ensure source kind matches tool engine
yq '.tools[] | select(.kind == "sqlite-sql") | .source as $s | ., ("kind=" + .sources[$s].kind)' tools.yaml Type guard
func isSQLiteSource(s sources.Source) bool {
_, ok := s.(sqlitesql.CompatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
log.Fatalf("tool/source engine mismatch: %v", err)
} Prevention
- Audit tools.yaml pairing of tool kinds to source kinds after edits.
- Run config validation at process start.
- Use distinct config files per database engine.
- Add integration test that instantiates every tool with its declared source.
When it happens
Trigger: `sqlite-sql` tool's `source:` references a postgres/mysql/spanner/other source; direct Go call to ValidateSource with a mismatched source.
Common situations: Copy-pasting tool blocks between source sections without changing the `source` field; consolidating configs for multiple databases.
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/58215938d8d9f093.
Report an issue: GitHub.