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 dataplex-list-data-products tool only works with a Dataplex source that implements its compatibleSource interface (ListDataProducts method). ValidateSource type-asserts the injected source and returns this error when the attached source is a different kind (e.g. a Postgres source wired to a Dataplex tool). It is a configuration/wiring error, not a runtime data error.

Source

Thrown at internal/tools/dataplex/dataplexlistdataproducts/dataplexlistdataproducts.go:114

// validate interface
var _ tools.Tool = Tool{}

type Tool struct {
	tools.BaseTool[Config]
}

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
}

func (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {
	source, ok := s.(compatibleSource)
	if !ok {
		return nil, util.NewClientServerError("source used is not compatible with the tool", http.StatusInternalServerError, nil)
	}
	paramsMap := params.AsMap()
	filter, _ := paramsMap["filter"].(string)
	pageSize, _ := paramsMap["pageSize"].(int)
	orderBy, _ := paramsMap["orderBy"].(string)

	resp, err := source.ListDataProducts(ctx, filter, pageSize, orderBy)
	if err != nil {
		return nil, util.ProcessGcpError(err)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's source to a Dataplex source (sourceKind: dataplex) in the tools config
  2. Verify the source entry under `sources:` is type dataplex and initializes successfully
  3. Rebuild/restart toolbox and confirm tool startup validation passes

Example fix

// before
tools:
  list-data-products:
    kind: dataplex-list-data-products
    source: my-postgres-source
// after
tools:
  list-data-products:
    kind: dataplex-list-data-products
    source: my-dataplex-source
Defensive patterns

Strategy: type-guard

Validate before calling

// Go: before wiring the tool
var _ sources.Source = mySource
if _, ok := mySource.(interface {
	ListDataProducts(ctx context.Context, filter string, pageSize int, orderBy string) ([]*dataplex.DataProductSummary, error)
}); !ok {
	return fmt.Errorf("source %T is not compatible with dataplex-list-data-products", mySource)
}

Type guard

func isDataplexListDataProductsSource(s sources.Source) bool {
	_, ok := s.(interface {
		ListDataProducts(ctx context.Context, filter string, pageSize int, orderBy string) ([]*dataplex.DataProductSummary, error)
	})
	return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
	// handle invalid-source-type: fix tool->source binding in config
	log.Printf("invalid source binding: %v", err)
	return err
}

Prevention

When it happens

Trigger: Calling ValidateSource (or tool invocation) on dataplex-list-data-products when the attached sources.Source does not implement compatibleSource (ListDataProducts(ctx, filter, pageSize, orderBy)).

Common situations: YAML config assigns a non-Dataplex source to this tool; copying a tool block from another integration without changing its source; renames/refactors that changed the Dataplex source type.

Related errors


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