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-pg-settings tool's ValidateSource rejects the configured source because it does not implement compatibleSource (PostgresPool() *pgxpool.Pool plus RunSQL). Toolbox checks tool/source compatibility at startup so failures surface early instead of at invocation time. The configured `source:` names a source kind that cannot serve Postgres pg_settings queries.

Source

Thrown at internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings.go:137

	resp, err := source.RunSQL(ctx, listPgSettingsStatement, 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 the tool's `source:` to a Postgres-family source (postgres, cloud-sql-postgres, alloydb-postgres).
  2. Verify the source exists under `sources:` and its `kind` implements the Postgres pool interface.
  3. Use the tool variant matching your actual source kind if you are not on Postgres.

Example fix

# before
tools:
  pg-settings:
    kind: postgres-list-pg-settings
    source: mysql-db
# after
tools:
  pg-settings:
    kind: postgres-list-pg-settings
    source: postgres-db
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-pg-settings 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-pg-settings` tool entry in the yaml whose `source:` points to a non-Postgres source (mysql, mssql, sqlite, http, etc.) or to an unregistered/typo'd source name.

Common situations: Hand-editing prebuilt configs across database engines; renaming a source but not updating the tool's `source:`; mixing cloud-sql-mysql sources with postgres tools.

Related errors


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