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

The dataplexgetrunstatus tool's ValidateSource produces this error when the source's concrete type does not satisfy the tool's `compatibleSource` interface (GetRunStatus method). This fail-fast check rejects sources that cannot look up Dataplex data-scan run status before Invoke is attempted. It indicates a tool-to-source type mismatch in wiring or code.

Source

Thrown at internal/tools/dataplex/dataplexgetrunstatus/dataplexgetrunstatus.go:100

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

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

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Configure the tool with a Dataplex source implementing GetRunStatus.
  2. Compare method sets against compatibleSource in internal/tools/dataplex/dataplexgetrunstatus/dataplexgetrunstatus.go.
  3. Add or fix GetRunStatus on custom sources to match the interface exactly.
  4. Update tests so fakes implement the tool's compatibleSource interface.

Example fix

// before
// tools:
//   run-status:
//     kind: dataplex-get-run-status
//     source: bigquery-source   # not compatible
//
// after
// tools:
//   run-status:
//     kind: dataplex-get-run-status
//     source: dataplex-source   # satisfies compatibleSource
Defensive patterns

Strategy: validation

Validate before calling

func checkRunStatusSupport(s sources.Source) error {
	if _, ok := s.(interface {
		GetRunStatus(ctx context.Context, dataScanId, jobRunId string) (*dataplex.Run, error)
	}); !ok {
		return errors.New("source lacks GetRunStatus; required by dataplex-get-run-status")
	}
	return nil
}

Type guard

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

Try / catch

if err := tool.ValidateSource(src); err != nil {
	return nil, fmt.Errorf("configuration error (no retry will help): %w", err)
}

Prevention

When it happens

Trigger: Calling ValidateSource with a source lacking GetRunStatus(ctx, dataScanId, jobRunId) with the exact signature — typically from wrong source wiring in tools.yaml or an incomplete test fake.

Common situations: Misconfigured tools.yaml referencing a non-Dataplex source; legacy or custom source implementations missing GetRunStatus; refactors renaming parameters so the source no longer satisfies the interface; version skew between tool and source packages.

Related errors


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