googleapis/mcp-toolbox · error

source is not compatible with the tool

Error message

source is not compatible with the tool

What it means

This error is returned by the bigtable-get-instance tool's ValidateSource when the sources.Source handed to it does not implement the tool's private compatibleSource interface (here, a type exposing GetInstance(context.Context, string) (any, error)). MCP Toolbox only wires a tool to a source at runtime, so any source whose concrete type lacks the required Bigtable method fails the type assertion. It is a configuration/wiring mismatch, not a Bigtable API failure.

Source

Thrown at internal/tools/bigtable/bigtablegetinstance/bigtablegetinstance.go:94

			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.GetInstance(ctx, paramsMap["instance_id"].(string))
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's source in tools.yaml at a source declared with kind: bigtable
  2. Verify the source implements GetInstance(context.Context, string) (any, error) (custom sources) and matches the toolbox version
  3. Rebuild/regenerate the config so the tool and source versions align
  4. Run the toolbox with --prebuilt or validate the config at startup to catch mismatches before serving

Example fix

// before (tools.yaml)
tools:
  get-instance:
    kind: bigtable-get-instance
    source: my-postgres-source
// after
tools:
  get-instance:
    kind: bigtable-get-instance
    source: my-bigtable-source
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func isBigtableSource(s sources.Source) bool {
    _, ok := s.(interface{ GetInstance(context.Context, string) (any, error) })
    return ok
}

Try / catch

source, err := loadSource(cfg.SourceName)
if err := tool.ValidateSource(source); err != nil {
    log.Fatalf("incompatible source for bigtable-get-instance: %v", err)
}

Prevention

When it happens

Trigger: Calling ValidateSource (or invoking the tool through the server) with a source whose concrete type is not the Bigtable source, e.g. a postgres, mysql, or bigquery source, or a Bigtable source from an incompatible version that lacks the GetInstance method.

Common situations: A tools.yaml binds bigtable-get-instance to a source of the wrong kind (copy-pasted config, wrong 'kind:' field); a custom source implementation is passed programmatically without the GetInstance method; or the toolbox version was upgraded and the source/tool interfaces drifted.

Related errors


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