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 dataplexlistdataassets tool's ValidateSource when the supplied sources.Source cannot be asserted to the tool's `compatibleSource` interface, i.e., it does not implement ListDataAssets. The tool requires a source able to list Dataplex assets within a data product; any other source kind fails validation with this message. It's a fail-fast compatibility check, not a Dataplex API error.

Source

Thrown at internal/tools/dataplex/dataplexlistdataassets/dataplexlistdataassets.go:117

// 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()
	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. Set the tool's `source` to a Dataplex source implementing ListDataAssets.
  2. Verify compliance with the compatibleSource interface in internal/tools/dataplex/dataplexlistdataassets/dataplexlistdataassets.go.
  3. Implement the missing ListDataAssets method on custom sources with the exact signature.
  4. Add a compile-time assertion `var _ compatibleSource = (*MySource)(nil)` to prevent future drift.

Example fix

// before
// kind: dataplex-list-data-assets
// source: mssql-source   # does not implement ListDataAssets
//
// after
// kind: dataplex-list-data-assets
// source: dataplex-source # implements compatibleSource
Defensive patterns

Strategy: type-guard

Validate before calling

var _ interface {
	ListDataAssets(ctx context.Context, projectId, locationId, dataProductId string) ([]*dataplex.DataAsset, error)
} = (*myDataplexSource)(nil)

Type guard

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

Try / catch

if err := tool.ValidateSource(src); err != nil {
	if strings.Contains(err.Error(), "not a compatible type") {
		// Swap in the correct dataplex source; do not retry.
		return nil, fmt.Errorf("tool %q misconfigured: %w", toolName, err)
	}
	return nil, err
}

Prevention

When it happens

Trigger: ValidateSource (or server startup) receives a source whose concrete type is missing ListDataAssets(ctx, projectId, locationId, dataProductId) — e.g., the tool block in tools.yaml points at a different engine's source, or a test supplies a stub implementing only sources.Source.

Common situations: Copy-pasted tool configs retaining the wrong `source:` value; custom source integrations missing the listing method; interface drift after a signature change; running an outdated binary where the source kind's method set differs.

Related errors


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