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

dataplex-search-dq-scans requires a source implementing its compatibleSource interface (SearchDqScans method). ValidateSource returns this error when the injected source is of an incompatible type, guarding against misconfigured tool/source bindings.

Source

Thrown at internal/tools/dataplex/dataplexsearchdqscans/dataplexsearchdqscans.go:101

// 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)
	dataScanID, _ := paramsMap["dataScanId"].(string)
	resourcePath, _ := paramsMap["resourcePath"].(string)
	pageSize, _ := paramsMap["pageSize"].(int)
	orderBy, _ := paramsMap["orderBy"].(string)

	var filters []string
	if filter != "" {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's source at a dataplex source in the config
  2. Verify the source kind is dataplex and it initializes
  3. Restart the server and confirm no validation errors at startup

Example fix

// before
source: mysql
// after
source: dataplex
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := src.(interface {
	SearchDqScans(ctx context.Context, query string, pageSize int32) (*dataplex.GoogleCloudDataplexV1SearchScansResponse, error)
}); !ok {
	return fmt.Errorf("source %T does not support SearchDqScans", src)
}

Type guard

func isDataplexSearchDqScansSource(s sources.Source) bool {
	_, ok := s.(interface {
		SearchDqScans(ctx context.Context, query string, pageSize int32) (*dataplex.GoogleCloudDataplexV1SearchScansResponse, error)
	})
	return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
	// incompatible source: rebind the tool to a dataplex source
	return fmt.Errorf("invalid tool source: %w", err)
}

Prevention

When it happens

Trigger: ValidateSource is invoked with a sources.Source lacking the SearchDqScans method required for dataplex-search-dq-scans.

Common situations: YAML wiring the tool to a database source; a source block deleted/renamed so the tool binds to the wrong entry.

Related errors


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