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-lookup-entry requires a source implementing its compatibleSource interface (LookupEntry method). ValidateSource type-asserts the attached source and returns this error when it is not a Dataplex-compatible source. It prevents invoking the tool against an unrelated source type.

Source

Thrown at internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry.go:115

// 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()
	entry, _ := paramsMap["entry"].(string)
	view, _ := paramsMap["view"].(int)
	aspectTypeSlice, err := parameters.ConvertAnySliceToTyped(paramsMap["aspectTypes"].([]any), "string")
	if err != nil {
		return nil, util.NewAgentError(fmt.Sprintf("can't convert aspectTypes to array of strings: %s", err), err)
	}
	parts := strings.Split(entry, "/")
	if len(parts) < 4 || parts[0] != "projects" || parts[2] != "locations" {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Bind the tool to a dataplex source in the config
  2. Confirm the referenced source is defined and of kind dataplex
  3. Restart toolbox so startup source validation runs

Example fix

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

Strategy: type-guard

Validate before calling

if _, ok := src.(interface {
	LookupEntry(ctx context.Context, name, view string, aspectTypes []string, entry string) (*dataplex.GoogleCloudDataplexV1Entry, error)
}); !ok {
	return fmt.Errorf("source %T does not support LookupEntry", src)
}

Type guard

func isDataplexLookupEntrySource(s sources.Source) bool {
	_, ok := s.(interface {
		LookupEntry(ctx context.Context, name, view string, aspectTypes []string, entry string) (*dataplex.GoogleCloudDataplexV1Entry, error)
	})
	return ok
}

Try / catch

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

Prevention

When it happens

Trigger: ValidateSource (or Invoke) receives a sources.Source that lacks the LookupEntry method signature required by dataplex-lookup-entry.

Common situations: Misconfigured YAML binding the tool to a non-Dataplex source; copy-pasted tool definitions referencing another integration's source.

Related errors


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