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

ValidateSource() for the alloydbainl tool asserts the source implements its compatibleSource interface (an AlloyDB Postgres-compatible source with NL-config support). Any other source type is rejected with this error identifying the tool type and configured source name.

Source

Thrown at internal/tools/alloydbainl/alloydbainl.go:155

	resp, err := source.RunSQL(ctx, t.Statement, allParamValues)
	if err != nil {
		return nil, util.NewClientServerError(fmt.Sprintf("error running SQL query: %v. Query: %v , Values: %v. Toolbox v0.19.0+ is only compatible with AlloyDB AI NL v1.0.3+. Please ensure that you are using the latest AlloyDB AI NL extension", err, t.Statement, allParamValues), http.StatusBadRequest, err)
	}
	return resp, 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

  1. Set the tool's source to an AlloyDB source implementing compatibleSource.
  2. Confirm the source kind under sources: matches alloydb (Postgres-compatible AlloyDB).
  3. Use the NL tool variant intended for the other database engine if that's the actual target.
Defensive patterns

Strategy: type-guard

Validate before calling

if err := tool.ValidateSource(src); err != nil {
    return fmt.Errorf("alloydbainl bound to wrong source: %w", err)
}

Type guard

cs, ok := src.(alloydbainl.CompatibleSource)
if !ok {
    return fmt.Errorf("source %T is not AlloyDB-compatible for NL tool", src)
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
    log.Fatalf("invalid source binding: %v", err)
}

Prevention

When it happens

Trigger: Binding an alloydbainl tool to a non-AlloyDB source (e.g. mysql, mssql, or a plain source lacking the required methods) and calling ValidateSource during server startup.

Common situations: Pointing the NL tool at a mysql or cloud-sql source instead of the alloydb source; renaming sources so the reference resolves to a different kind; prebuilt config edits.

Related errors


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