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

Raised by the dataplexgetdataqualityresults tool's ValidateSource when the given sources.Source does not implement the tool's `compatibleSource` interface (GetDataQualityResults). The tool requires a source capable of querying Dataplex data-quality scan results; any incompatible source fails the type assertion and produces this error before Invoke. This is a wiring/compatibility failure rather than a Dataplex API error.

Source

Thrown at internal/tools/dataplex/dataplexgetdataqualityresults/dataplexgetdataqualityresults.go:99

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()
	scanId, _ := paramsMap["scanId"].(string)
	location, _ := paramsMap["location"].(string)

	if scanId == "" {
		return nil, util.NewAgentError("scanId parameter is required", nil)
	}
	if location == "" {
		return nil, util.NewAgentError("location parameter is required", nil)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Configure the tool with a Dataplex source that implements GetDataQualityResults.
  2. Inspect the compatibleSource interface in internal/tools/dataplex/dataplexgetdataqualityresults/dataplexgetdataqualityresults.go and match it exactly.
  3. Implement the missing method on any custom source with the exact signature.
  4. Update stale source implementations/packages to the current interface.

Example fix

// before
// kind: dataplex-get-data-quality-results
// source: alloydb-source   # lacks GetDataQualityResults
//
// after
// kind: dataplex-get-data-quality-results
// source: dataplex-source  # satisfies compatibleSource
Defensive patterns

Strategy: validation

Validate before calling

func assertDataQualitySource(s sources.Source) error {
	if _, ok := s.(interface {
		GetDataQualityResults(ctx context.Context, /* params */) (*dataplex.DataQualityResult, error)
	}); !ok {
		return errors.New("source must implement GetDataQualityResults for dataplex-get-data-quality-results")
	}
	return nil
}

Type guard

func isDataQualitySource(s sources.Source) bool {
	_, ok := s.(dataplexgetdataqualityresults.CompatibleSource)
	return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
	// Non-retryable: correct the config/source, don't retry.
	return nil, fmt.Errorf("non-retryable source compatibility failure: %w", err)
}

Prevention

When it happens

Trigger: ValidateSource receives a source whose concrete type lacks GetDataQualityResults with the expected signature — e.g., tools.yaml binds this tool to a non-Dataplex source, or a test stub omits the method.

Common situations: Config mistakes where the `source` field references another engine's source; older source versions predating the data-quality-results method; refactors that renamed parameters and broke interface compliance; unit-test fakes implementing only sources.Source.

Related errors


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