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 on the looker-get-project-files tool asserts the provided sources.Source to its compatibleSource interface. Any source that is not the Looker API source fails the assertion and produces this error, preventing the tool from being used with that source. Same family as the other Looker tool source-mismatch errors.

Source

Thrown at internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles.go:106

// 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)
	}

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

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's `source:` field to a source of kind `looker` in your configuration.
  2. Cross-check every looker-* tool entry: each must reference the same Looker source (or another Looker-kind source).
  3. Restart the server and confirm no ValidateSource errors appear at startup.

Example fix

// before
tool:
  kind: looker-get-project-files
  source: warehouse  # not a looker source
// after
tool:
  kind: looker-get-project-files
  source: my-looker
Defensive patterns

Strategy: type-guard

Validate before calling

// Fail fast when a looker tool is bound to a non-looker source
for name, toolCfg := range cfg.Tools {
    if strings.HasPrefix(toolCfg.Kind, "looker-") {
        if cfg.Sources[toolCfg.Source].GetSourceConfigType() != "looker" {
            return fmt.Errorf("tool %q (%s) must bind to a looker source", name, toolCfg.Kind)
        }
    }
}

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("fix 'source:' binding for looker-get-project-files (must be kind: looker): %w", err)
}

Prevention

When it happens

Trigger: ValidateSource is called (at toolset build, server startup, or per-invocation checks) with a source bound to a looker-get-project-files tool that does not implement compatibleSource, e.g. a postgres or http source.

Common situations: tools.yaml tool entries pointing at the wrong source name; renamed or replaced sources; sharing one toolset definition across projects where source kinds differ.

Related errors


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