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-delete-materialized-view tool asserts that the provided source implements its compatibleSource (Bigtable source) interface. On failure it returns the generic 'source is not compatible with the tool' error, meaning the tool was handed a source it cannot operate on.

Source

Thrown at internal/tools/bigtable/bigtabledeletematerializedview/bigtabledeletematerializedview.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.DeleteMaterializedView(ctx, paramsMap["instance_id"].(string), paramsMap["materialized_view_id"].(string))
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's source to a bigtable-kind source.
  2. Implement the compatibleSource interface on any custom Bigtable wrapper.
  3. Verify the referenced source name exists and is the intended Bigtable source.
  4. Restart the server after fixing the config.

Example fix

// before
tools:
  delete-mv:
    kind: bigtable-delete-materialized-view
    source: my-postgres-source
// after
tools:
  delete-mv:
    kind: bigtable-delete-materialized-view
    source: my-bigtable-source
Defensive patterns

Strategy: type-guard

Validate before calling

func isBigtableSource(s sources.Source) bool {
    _, ok := s.(interface{ BigtableClient() *bigtable.Client }); 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 tool requires a bigtable source: %w", err)
}

Prevention

When it happens

Trigger: ValidateSource called with a non-Bigtable sources.Source — e.g. the tool bound to a Postgres/BigQuery source in the config.

Common situations: Wrong source kind under the tool in tools.yaml; a wrapper type around Bigtable that doesn't implement the interface; tests passing another source implementation.

Related errors


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