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

Tool.ValidateSource in the snowflake-sql tool asserts that the configured source implements the tool's compatibleSource interface. When the source registered under the tool's `source` name is of a different concrete type, the assertion fails and this error is returned during config validation.

Source

Thrown at internal/tools/snowflake/snowflakesql/snowflakesql.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

  1. Point the snowflake-sql tool's `source:` field at a source of kind snowflake.
  2. Cross-check every tool's source reference against the `sources:` section of your config; each snowflake tool must reference a snowflake-kind source.
  3. If registering sources in code, pass the concrete snowflake source (which implements SpannerClient/RunSQL-equivalent methods) to the tool.

Example fix

// before (tools.yaml)
tools:
  my-sql:
    kind: snowflake-sql
    source: bigquery-src
// after
tools:
  my-sql:
    kind: snowflake-sql
    source: snowflake-src
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := src.(compatibleSource); !ok {
	return fmt.Errorf("source %q does not implement compatibleSource", srcName)
}

Type guard

cs, ok := source.(compatibleSource)
if !ok {
	return nil, fmt.Errorf("snowflake-sql requires a snowflake-compatible source")
}

Prevention

When it happens

Trigger: ValidateSource is invoked (at toolbox startup or via the tools API) with a sources.Source that does not satisfy compatibleSource — e.g. wiring snowflake-sql to a cloud-sql-postgres source.

Common situations: Mismatched `source:` reference in tools.yaml; renamed sources causing a tool to bind to a leftover source of another engine; building tools programmatically with the wrong Source instance.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/58fe664222e23088. Report an issue: GitHub.