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

The postgres-list-sequences tool's ValidateSource fails because the bound source does not satisfy compatibleSource (PostgresPool() *pgxpool.Pool and RunSQL). Sequence listing requires Postgres catalog access through the pgx pool, so only Postgres-family sources are accepted. Validation happens when the tool is constructed and paired with its source.

Source

Thrown at internal/tools/postgres/postgreslistsequences/postgreslistsequences.go:142

	resp, err := source.RunSQL(ctx, listSequencesStatement, sliceParams)
	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. Point `source:` at a Postgres-family source (postgres, cloud-sql-postgres, alloydb-postgres).
  2. Verify the source exists in `sources:` with a Postgres `kind`.
  3. Choose the matching tool for your engine if not on Postgres.

Example fix

# before
tools:
  list-sequences:
    kind: postgres-list-sequences
    source: mysql-analytics
# after
tools:
  list-sequences:
    kind: postgres-list-sequences
    source: pg-analytics
Defensive patterns

Strategy: validation

Validate before calling

src := myConfig.sources[tool.Source]
if _, ok := src.(interface {
    PostgresPool() *pgxpool.Pool
    RunSQL(context.Context, string, []any) (any, error)
}); !ok {
    return fmt.Errorf("postgres-list-sequences requires a Postgres-family source, got %T", src)
}

Type guard

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

Prevention

When it happens

Trigger: A `postgres-list-sequences` tool whose `source:` references a non-Postgres source kind (mysql, mssql, sqlite, http, etc.) or a typo'd/missing source name.

Common situations: Copy-paste tool blocks between engine configs; stale source names after refactoring yaml; mixing managed MySQL sources with postgres tools.

Related errors


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