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

vector-assist-apply-spec only works with sources exposing a pgx pool and RunSQL helper (its compatibleSource interface). ValidateSource returns this error when the bound sources.Source does not satisfy that interface, i.e. it is not a Postgres-based source the Vector Assist tooling can drive.

Source

Thrown at internal/tools/cloudsqlpg/vectorassistapplyspec/vectorassistapplyspec.go:131

	resp, err := source.RunSQL(ctx, applySpecQuery, []any{namedArgs})
	if err != nil {
		return nil, util.ProcessGeneralError(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. Bind the tool to a postgres or cloud-sql-postgres source that implements PostgresPool() and RunSQL()
  2. Check that your custom source (if any) satisfies the full compatibleSource interface
  3. Verify the config with the tool manifest before deployment

Example fix

// before
source: my-mysql
// after
source: my-postgres  # kind: postgres or cloud-sql-postgres
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := src.(interface{ RunSQL(context.Context, string, []any) (any, error) }); !ok { return errors.New("vector-assist tools need a postgres-based source") }

Type guard

func isVectorAssistSource(s sources.Source) bool {
    _, ok := s.(interface {
        PostgresPool() *pgxpool.Pool
        RunSQL(context.Context, string, []any) (any, error)
    })
    return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
    return fmt.Errorf("vector-assist-apply-spec cannot bind to this source: %w", err)
}

Prevention

When it happens

Trigger: Tool initialization/validate step where `source.(compatibleSource)` fails — binding vector-assist-apply-spec to a non-postgres source (mysql, cloud-sql-mysql, spanner, etc.) or a source missing RunSQL/PostgresPool support.

Common situations: Attaching Vector Assist tools to the wrong engine's source; using an older custom source that predates the RunSQL-bearing interface; copy-pasted configs across toolsets.

Related errors


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