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-schemas tool's ValidateSource rejects the attached source because it does not implement compatibleSource (PostgresPool() *pgxpool.Pool and RunSQL). Schema introspection uses pg_catalog via the pgx pool, so only Postgres-family sources qualify. The error fires during startup source/tool validation.

Source

Thrown at internal/tools/postgres/postgreslistschemas/postgreslistschemas.go:175

	resp, err := source.RunSQL(ctx, listSchemasStatement, 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. Set `source:` to a Postgres-family source (postgres, cloud-sql-postgres, alloydb-postgres).
  2. Confirm the source is defined and its `kind` supports the pgx pool interface.
  3. Use the engine-appropriate tool if the source is not Postgres.

Example fix

# before
tools:
  list-schemas:
    kind: postgres-list-schemas
    source: mssql-warehouse
# after
tools:
  list-schemas:
    kind: postgres-list-schemas
    source: pg-warehouse
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-schemas 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-schemas` tool whose `source:` resolves to an incompatible source kind (mysql, mssql, sqlite, http, etc.) or to a name not present in `sources:`.

Common situations: Editing prebuilt configs by hand; source renamed without updating tool references; accidental cross-engine tool reuse.

Related errors


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