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
This error comes from Tool.ValidateSource in the snowflake-execute-sql tool. MCP Toolbox validates at startup that every tool's configured source implements the tool's compatibleSource interface (a Spanner/Snowflake source exposing the client and RunSQL methods). If the source named in the tool's YAML config resolves to a source of a different type, the type assertion fails and this error is thrown.
Source
Thrown at internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql.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)
}
mapParams := params.AsMap()
sqlStr, ok := mapParams["sql"].(string)
if !ok {
return nil, util.NewAgentError("invalid parameters: sql parameter is not a string", nil)
}
// Log the query executed for debugging.
logger, err := util.LoggerFromContext(ctx)
if err != nil {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Check the `source:` field of the snowflake-execute-sql tool in your YAML and point it at a source defined with kind snowflake (or another type implementing the tool's compatibleSource interface).
- Run the toolbox binary with your config; ValidateSource runs at startup and will name the offending tool and source, letting you fix the mapping.
- If defining sources programmatically, ensure the Source passed to ValidateSource is the concrete snowflake source type, not a wrapper or different source.
Example fix
// before (tools.yaml)
tools:
execute-sql:
kind: snowflake-execute-sql
source: my-postgres-source
// after
tools:
execute-sql:
kind: snowflake-execute-sql
source: my-snowflake-source Defensive patterns
Strategy: validation
Validate before calling
func isSnowflakeCompatible(s sources.Source) bool {
_, ok := s.(interface {
SnowflakeClient() *sql.DB
RunSQL(context.Context, string, map[string]any) (any, error)
})
return ok
}
// before registering the tool:
// if !isSnowflakeCompatible(cfg.Source) { return fmt.Errorf("tool %q requires a snowflake source", name) } Type guard
func asCompatibleSource(s sources.Source) (compatibleSource, bool) {
cs, ok := s.(compatibleSource)
return cs, ok
} Prevention
- Keep tool `source:` references pointing at sources of the matching kind; audit tools.yaml after renames.
- Run the toolbox once against your config in CI; ValidateSource fails fast at startup.
- Name sources after their engine (e.g. `snowflake-prod`) to make mismatches obvious.
When it happens
Trigger: Calling ValidateSource (directly or via toolbox startup/config loading) when the tool's `source` field points to a source whose concrete type does not implement compatibleSource (e.g. a postgres or alloydb source wired to a snowflake-execute-sql tool).
Common situations: Copy-pasting a tools.yaml between projects where the tool's `source` name matches but points to the wrong kind of source; refactoring source names so two sources swap; using prebuilt configs against a source of the wrong engine.
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/fc1077dbad8ad326.
Report an issue: GitHub.