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

Source-compatibility check in ValidateSource: the configured source does not implement the ListClusters-compatible Dataproc interface, so the list-clusters tool is bound to a source that cannot enumerate Dataproc clusters.

Source

Thrown at internal/tools/dataproc/dataproclistclusters/dataproclistclusters.go:102

var _ tools.Tool = Tool{}

// Tool is the implementation of the 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
}

type compatibleSource interface {
	ListClusters(context.Context, *int, string, string) (any, error)
}

// Invoke executes the tool's operation.
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)
	}
	paramMap := params.AsMap()
	var pageSize *int
	if ps, ok := paramMap["pageSize"]; ok && ps != nil {
		pageSizeV := ps.(int)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's source field at a dataproc source instance
  2. Verify the source kind in tools.yaml matches the Dataproc source
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at internal/tools/dataproc/dataproclistclusters/dataproclistclusters.go:102 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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