googleapis/mcp-toolbox · error

source is not compatible with the tool

Error message

source is not compatible with the tool

What it means

ValidateSource for the bigtable-get-cluster tool performs a compatibleSource type assertion on the given source and returns 'source is not compatible with the tool' when it fails. This ensures the tool only runs against Bigtable sources that expose the cluster APIs it needs.

Source

Thrown at internal/tools/bigtable/bigtablegetcluster/bigtablegetcluster.go:95

			allParameters,
		),
	}, nil
}

var _ tools.Tool = Tool{}

type Tool struct {
	tools.BaseTool[Config]
}

func (t Tool) GetSourceName() string {
	return t.Cfg.Source
}

func (t Tool) ValidateSource(src sources.Source) error {
	_, ok := src.(compatibleSource)
	if !ok {
		return fmt.Errorf("source is not compatible with the tool")
	}
	return nil
}

func (t Tool) ToConfig() tools.ToolConfig {
	return t.Cfg
}

func (t Tool) Invoke(ctx context.Context, src sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {
	source, ok := src.(compatibleSource)
	if !ok {
		return nil, util.NewClientServerError("source used is not compatible with the tool", http.StatusInternalServerError, nil)
	}

	paramsMap := params.AsMap()

	res, err := source.GetCluster(ctx, paramsMap["instance_id"].(string), paramsMap["cluster_id"].(string))
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool at a bigtable source.
  2. Implement compatibleSource on custom Bigtable source wrappers.
  3. Fix the source reference in the tool config and restart.
  4. Check for copy-paste mistakes where a sibling tool's source was reused.

Example fix

// before
tools:
  get-cluster:
    kind: bigtable-get-cluster
    source: my-spanner-source
// after
tools:
  get-cluster:
    kind: bigtable-get-cluster
    source: my-bigtable-source
Defensive patterns

Strategy: type-guard

Validate before calling

func isBigtableSource(s sources.Source) bool {
    _, ok := s.(interface{ BigtableInstanceAdminClient() *bigtable.InstanceAdminClient }); return ok
}
// then tool.ValidateSource(src)

Type guard

func asBigtable(s sources.Source) (compatibleSource, bool) { c, ok := s.(compatibleSource); return c, ok }

Try / catch

if err := tool.ValidateSource(src); err != nil {
    return fmt.Errorf("bigtable-get-cluster needs a bigtable source: %w", err)
}

Prevention

When it happens

Trigger: ValidateSource called with any sources.Source that is not the Bigtable compatibleSource — wrong source kind bound to the tool, or a stub in tests.

Common situations: Misconfigured tools.yaml pointing get-cluster at a non-Bigtable source; custom source implementations missing required methods; copy-pasted tool blocks referencing the previous tool's source.

Related errors


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