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

Thrown by the dataplexgetoperation tool's ValidateSource when the passed sources.Source fails the assertion to `compatibleSource`, which requires a GetOperation(ctx, name) method. The tool uses this guard to guarantee the source can poll a Dataplex long-running operation before proceeding. The error means the tool was handed a source of an incompatible concrete type — a configuration or implementation issue, not an API failure.

Source

Thrown at internal/tools/dataplex/dataplexgetoperation/dataplexgetoperation.go:95

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

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

	resp, err := source.GetOperation(ctx, operationName)
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's `source` config at a Dataplex source implementing GetOperation.
  2. Verify the exact interface in internal/tools/dataplex/dataplexgetoperation/dataplexgetoperation.go and match it.
  3. Implement GetOperation on custom sources with the exact signature.
  4. Rebuild against the current source package if the implementation is stale.

Example fix

// before
// kind: dataplex-get-operation
// source: postgres-source  # incompatible type
//
// after
// kind: dataplex-get-operation
// source: dataplex-source  # implements compatibleSource.GetOperation
Defensive patterns

Strategy: type-guard

Validate before calling

type operationSource interface {
	GetOperation(ctx context.Context, name string) (*longrunningpb.Operation, error)
}
if _, ok := src.(operationSource); !ok {
	return errors.New("source cannot poll Dataplex operations")
}

Type guard

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

Try / catch

if err := tool.ValidateSource(src); err != nil {
	// treat as configuration error; no retry
	return nil, fmt.Errorf("fix source wiring for dataplex-get-operation: %w", err)
}

Prevention

When it happens

Trigger: ValidateSource is called with any source that does not implement GetOperation(context.Context, string) — e.g., the tool is wired to a database source in tools.yaml, or a test passes a minimal stub of sources.Source.

Common situations: Tool YAML references the wrong source name; custom source lacks the GetOperation method; older source builds predate the method; interface compliance broken after a signature refactor.

Related errors


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