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-entries validates its attached source implements its compatibleSource interface (SearchEntries method). ValidateSource returns this error when any other source type is supplied. It ensures the tool only runs against a Dataplex source that can perform entry searches.

Source

Thrown at internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries.go:104

// 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()
	query, ok := paramsMap["query"].(string)
	if !ok {
		return nil, util.NewAgentError(fmt.Sprintf("error casting 'query' parameter: %v", paramsMap["query"]), nil)
	}
	pageSize, ok := paramsMap["pageSize"].(int)
	if !ok {
		return nil, util.NewAgentError(fmt.Sprintf("error casting 'pageSize' parameter: %v", paramsMap["pageSize"]), nil)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Bind the tool to a dataplex source in the config
  2. Check the referenced source name/kind in the sources section
  3. Run startup validation and fix any reported source mismatches

Example fix

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

Strategy: type-guard

Validate before calling

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

Type guard

func isDataplexSearchEntriesSource(s sources.Source) bool {
	_, ok := s.(interface {
		SearchEntries(ctx context.Context, query string, pageSize int32, orderBy string) (*dataplex.GoogleCloudDataplexV1SearchEntriesResponse, error)
	})
	return ok
}

Try / catch

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

Prevention

When it happens

Trigger: ValidateSource (or Invoke) receives a sources.Source that does not implement compatibleSource (SearchEntries) for dataplex-search-entries.

Common situations: Tool bound to the wrong source in YAML; copy-pasted config from another integration; source renamed without updating tool bindings.

Related errors


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