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

ValidateSource enforces that the source bound to the looker-health-vacuum tool implements the looker compatibleSource interface. The library throws this when the assertion source.(compatibleSource) fails, i.e., the tool was configured against a non-Looker source. Invoke would similarly fail, so this check catches the misconfiguration early.

Source

Thrown at internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum.go:122

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)
	}
	sdk, err := source.GetLookerSDK(ctx, string(accessToken))
	if err != nil {
		return nil, util.NewClientServerError("error getting sdk", http.StatusInternalServerError, err)
	}

	paramsMap := params.AsMap()
	timeframe, _ := paramsMap["timeframe"].(int)
	if timeframe == 0 {
		timeframe = 90

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's source field at a source of kind looker in your config
  2. Verify the referenced source implements compatibleSource (check its SourceType and GetAuthTokenHeaderName)
  3. If wiring multiple sources, ensure names in the tool's source reference exactly match the looker source's declared name

Example fix

// before (toolbox.yaml)
tools:
  vacuum:
    kind: looker-health-vacuum
    source: bigquery-src
// after
tools:
  vacuum:
    kind: looker-health-vacuum
    source: looker-src
Defensive patterns

Strategy: type-guard

Validate before calling

// validate source compatibility before Invoke
if err := tool.ValidateSource(src); err != nil {
	return fmt.Errorf("source must be of kind looker: %w", err)
}

Type guard

func asCompatibleLookerSource(s sources.Source) (compatibleSource, bool) {
	cs, ok := s.(compatibleSource)
	return cs, ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
	return fmt.Errorf("check the tool's 'source' field points to a looker source: %w", err)
}

Prevention

When it happens

Trigger: ValidateSource receives a sources.Source whose concrete type does not satisfy compatibleSource — typically because the tool's source: field references a non-looker source.

Common situations: Toolbox YAML wiring the vacuum tool to a postgres/mssql/other source by mistake; renamed or refactored looker source kinds no longer matching the interface; dynamic tool construction passing an incompatible Source implementation.

Related errors


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