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-publication-tables tool's ValidateSource fails because the attached source does not satisfy compatibleSource (PostgresPool() *pgxpool.Pool and RunSQL). Publication tables are a Postgres-only concept, so only Postgres-family sources are accepted. Validation runs at startup when the tool is bound to its source.

Source

Thrown at internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables.go:150

	resp, err := source.RunSQL(ctx, listPublicationTablesStatement, 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. Check that the named source is defined and its `kind` is Postgres-based.
  3. If using another engine, switch to that engine's equivalent tool.

Example fix

# before
tools:
  pub-tables:
    kind: postgres-list-publication-tables
    source: mssql-db
# after
tools:
  pub-tables:
    kind: postgres-list-publication-tables
    source: alloydb-pg
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-publication-tables 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-publication-tables` tool whose `source:` resolves to a non-Postgres source kind (mysql, mssql, sqlite, http, etc.) or to a missing/typo'd source name.

Common situations: Reusing a tool block from a Postgres config inside a MySQL/SQL Server config; source renamed in `sources:` without updating tools; wrong prebuilt config merge.

Related errors


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