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 for looker-make-dashboard asserts the incoming sources.Source implements compatibleSource (Looker SDK methods). Any other source kind fails the assertion and produces this error, preventing the dashboard tool from being used with an incompatible backend.

Source

Thrown at internal/tools/looker/lookermakedashboard/lookermakedashboard.go:115

// validate interface
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)
	}
	logger, err := util.LoggerFromContext(ctx)
	if err != nil {
		return nil, util.NewClientServerError("unable to get logger from ctx", http.StatusInternalServerError, err)
	}
	logger.DebugContext(ctx, "params = ", params)

	sdk, err := source.GetLookerSDK(ctx, string(accessToken))
	if err != nil {
		return nil, util.NewClientServerError("error getting sdk", http.StatusInternalServerError, err)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's `source` at a source of kind looker.
  2. Verify the source name exists under `sources` and is the intended Looker instance.
  3. For custom sources, implement UseClientAuthorization, GetAuthTokenHeaderName, LookerApiSettings, and GetLookerSDK.

Example fix

# before
tools:
  make-dashboard:
    kind: looker-make-dashboard
    source: mysql-src

# after
tools:
  make-dashboard:
    kind: looker-make-dashboard
    source: looker-src
Defensive patterns

Strategy: type-guard

Validate before calling

// Go: guard before using the tool with a source
if err := tool.ValidateSource(src); err != nil {
    return fmt.Errorf("looker-make-dashboard requires a looker source: %w", err)
}

Type guard

func isLookerSource(s sources.Source) bool {
    _, ok := s.(interface {
        UseClientAuthorization() bool
        GetAuthTokenHeaderName() string
        LookerApiSettings() *rtl.ApiSettings
        GetLookerSDK(context.Context, string) (*v4.LookerSDK, error)
    })
    return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
    if strings.Contains(err.Error(), "not a compatible type") {
        return fmt.Errorf("check tools.yaml: source must be kind looker: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Invoking Tool.ValidateSource(source) where source is not a Looker source — typically a tools.yaml `source:` field naming a non-Looker source, or the wrong Source object passed during programmatic setup.

Common situations: Copy-pasted tool configs retaining a database source name; source renamed/refactored so it no longer satisfies the Looker interface; test harness supplying a partial stub source.

Related errors


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