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

This error is thrown by the dataplexgetdataasset tool's ValidateSource when the provided sources.Source fails the type assertion to the tool's `compatibleSource` interface, which requires a GetDataAsset(ctx, locationId, dataProductId, dataAssetId) method. The tool refuses to operate on any source that cannot perform the underlying Dataplex API lookup. This prevents runtime nil-method panics by failing fast at validation time.

Source

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

type Tool struct {
	tools.BaseTool[Config]
}

var _ tools.Tool = Tool{}

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()
	locationId, ok := paramsMap["locationId"].(string)
	if !ok || locationId == "" {
		return nil, util.NewAgentError("locationId is required and must be a non-empty string", nil)
	}
	dataProductId, ok := paramsMap["dataProductId"].(string)
	if !ok || dataProductId == "" {
		return nil, util.NewAgentError("dataProductId is required and must be a non-empty string", nil)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's `source` config field at a Dataplex source that implements GetDataAsset.
  2. Verify your source's concrete type satisfies the compatibleSource interface declared in internal/tools/dataplex/dataplexgetdataasset/dataplexgetdataasset.go:46.
  3. If implementing a custom source, add GetDataAsset with the exact signature from the interface.
  4. Update the source implementation/package if it predates the GetDataAsset method.

Example fix

// before
// kind: dataplex-get-data-asset
// source: bigquery-source   # does not implement GetDataAsset
//
// after
// kind: dataplex-get-data-asset
// source: dataplex-source   # implements compatibleSource.GetDataAsset
Defensive patterns

Strategy: type-guard

Validate before calling

type dataAssetSource interface {
	GetDataAsset(ctx context.Context, locationId, dataProductId, dataAssetId string) (*dataplex.DataAsset, error)
}
var _ dataAssetSource = sources.Dataplex{} // compile-time check

Type guard

func isGetdataAssetSource(s sources.Source) bool {
	_, ok := s.(interface {
		GetDataAsset(ctx context.Context, locationId, dataProductId, dataAssetId string) (*dataplex.DataAsset, error)
	})
	return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
	log.Printf("incompatible source for %s: %v", tool.GetName(), err)
	return nil, err // do not retry; fix the source wiring
}

Prevention

When it happens

Trigger: Calling ValidateSource with a source whose concrete Go type does not implement GetDataAsset with the exact signature `(ctx context.Context, locationId string, dataProductId string, dataAssetId string) (*dataplex.DataAsset, error)` — e.g., a non-Dataplex source, or a Dataplex source variant missing that method.

Common situations: Configuring the tool against a source of a different kind in tools.yaml; using an outdated Dataplex source implementation before GetDataAsset was added; test doubles that only satisfy sources.Source; version skew between the tool package and a vendored source package.

Related errors


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