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
Same pattern as the Spanner tool: sqlite-execute-sql's ValidateSource asserts that the bound source implements compatibleSource (an SQLite source exposing *sql.DB). Any non-SQLite source fails the assertion and yields this error, preventing cross-engine tool/source pairing.
Source
Thrown at internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql.go:101
// 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)
}
sqlStr, ok := params.AsMap()["sql"].(string)
if !ok {
return nil, util.NewAgentError("missing or invalid 'sql' parameter", nil)
}
if sqlStr == "" {
return nil, util.NewAgentError("sql parameter cannot be empty", nil)
}
// Log the query executed for debugging.View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source:` field at a source with `kind: sqlite`.
- Add/fix the sqlite source declaration in `sources:`.
- Validate tool-to-source engine compatibility at config load time.
Example fix
// before source: "my-postgres" // after source: "my-sqlite"
Defensive patterns
Strategy: type-guard
Validate before calling
yq '.tools[] | select(.kind == "sqlite-execute-sql") | .source' tools.yaml # cross-check the referenced source's kind is sqlite: yq '.sources[<name>].kind' tools.yaml
Type guard
func isSQLiteSource(s sources.Source) bool {
_, ok := s.(sqliteexecutesql.CompatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
return fmt.Errorf("bind %q to a sqlite source: %w", toolName, err)
} Prevention
- Name sources clearly by engine (my-sqlite, my-pg) and reference exactly.
- Run `toolbox --tools-file tools.yaml` (validate/dry-run) before deploying.
- Re-grep source refs after renaming any source.
- Avoid template variables that could swap source names between engines.
When it happens
Trigger: Tool of kind `sqlite-execute-sql` bound via `source:` to a source whose kind is not `sqlite`; passing a foreign sources.Source implementation directly to Invoke/ValidateSource.
Common situations: Reusing one shared tools.yaml across projects where source names collide; renaming the sqlite source but leaving the tool pointing at a different engine's source; dynamic tool wiring in Go code.
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/100a1a57ca3f0c8b.
Report an issue: GitHub.