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 the looker-get-projects tool type-asserts the supplied sources.Source to compatibleSource. If the source bound to the tool is not the Looker API source, the assertion fails and this error is returned. The tool can only operate on Looker sources.

Source

Thrown at internal/tools/looker/lookergetprojects/lookergetprojects.go:105

// 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) EmbedParams(ctx context.Context, paramValues parameters.ParamValues, pMgr tools.PrimitiveManagerI) (parameters.ParamValues, error) {
	return parameters.ParamValues{}, 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)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Update the tool's `source:` field to reference a kind: looker source.
  2. Audit all looker-* tool entries for correct source bindings in one pass.
  3. Restart and confirm the server starts without ValidateSource errors.

Example fix

// before
kind: looker-get-projects
source: pg-main
// after
kind: looker-get-projects
source: looker-main
Defensive patterns

Strategy: type-guard

Validate before calling

// Cross-check looker tool kinds against source kinds at load
toolKinds := map[string]bool{"looker-get-projects": true}
if toolKinds[toolCfg.Kind] && cfg.Sources[toolCfg.Source].GetSourceConfigType() != "looker" {
    return fmt.Errorf("tool %s requires a looker source; got %s", toolCfg.Name, cfg.Sources[toolCfg.Source].GetSourceConfigType())
}

Type guard

func isLookerSource(s sources.Source) bool {
    _, ok := s.(interface {
        UseClientAuthorization() bool
        GetAuthTokenHeaderName() string
    })
    return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
    return fmt.Errorf("looker-get-projects must bind to a kind: looker source: %w", err)
}

Prevention

When it happens

Trigger: ValidateSource runs during toolset construction or invocation with a non-Looker source (e.g. postgres, cloud-sql, http) bound to a looker-get-projects tool entry.

Common situations: Wrong `source:` value in tools.yaml; source renamed so the tool silently binds elsewhere; mixing Looker tools into toolsets built for other databases.

Related errors


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