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 checks that the sources.Source passed to the lookercreateagent tool satisfies the tool's compatibleSource interface via type assertion. When the bound source does not implement the Looker-specific methods the interface requires, the tool rejects it. This is a fail-fast guard ensuring the tool is only used with Looker sources it can actually talk to.

Source

Thrown at internal/tools/looker/lookercreateagent/lookercreateagent.go:126

// 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. Update the tool config so its 'source' references a Looker source implementing compatibleSource.
  2. Implement the missing compatibleSource methods (UseClientAuthorization, GetAuthTokenHeaderName, etc.) if this is your custom source.
  3. Rebuild the toolbox so interface changes in sources are picked up.
  4. Cross-check tool definitions in YAML against the source kinds documented for looker-create-agent.

Example fix

// before: custom source missing interface methods
type MySource struct{ sources.Source }
// after: satisfy compatibleSource
type MySource struct{ sources.Source }
func (s MySource) UseClientAuthorization() bool { return false }
func (s MySource) GetAuthTokenHeaderName() string { return "X-Looker-Api-Session-Token" }
Defensive patterns

Strategy: type-guard

Validate before calling

// Go: assert the source implements the tool's interface before wiring
func validatePairing(t tools.Tool, s sources.Source) error {
    if v, ok := t.(interface{ ValidateSource(sources.Source) error }); ok {
        return v.ValidateSource(s)
    }
    return nil
}

Type guard

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

Prevention

When it happens

Trigger: Any Invoke/authorization setup path that hands the tool a source of the wrong concrete type — e.g. a looker-create-agent tool configured with a non-Looker source, or a custom source lacking the compatibleSource methods.

Common situations: Miswired YAML mapping the tool to the wrong source; custom sources that embed the base source but omit Looker-specific methods; stale binaries after source interface refactors.

Related errors


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