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-update-dashboard-element asserts the bound source implements compatibleSource. Failure means the tool is attached to a non-Looker source; since all Invoke paths call Looker SDK methods through that interface, the tool rejects the binding with this error.

Source

Thrown at internal/tools/looker/lookerupdatedashboardelement/lookerupdatedashboardelement.go:132

	visType  string = "vis"
)

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)

	wq, err := lookercommon.ProcessQueryArgs(ctx, params)
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's `source` to your Looker source name
  2. Confirm the source's kind is looker in the sources section of the config
  3. Check startup logs that the Looker source initialized before tool validation

Example fix

// before
source: my-looker-look (typo, resolves to another source)
// after
source: my-looker-source
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := src.(looker.Source); !ok {
    return fmt.Errorf("expected looker source, got %T", src)
}

Type guard

func isLookerSource(s sources.Source) bool {
    _, ok := s.(looker.Source)
    return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
    if strings.Contains(err.Error(), "not a compatible type") {
        // correct the tool->source mapping and revalidate
    }
    return err
}

Prevention

When it happens

Trigger: Invoked during startup validation of tool-source pairs, or immediately before Invoke; triggers when `source:` in the tool config names a source that is not a Looker source.

Common situations: Misconfigured source reference; source renamed so a wrong/placeholder source resolves; programmatic wiring with an incompatible sources.Source implementation.

Related errors


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