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-delete-gitbranch asserts the provided sources.Source against the package's compatibleSource interface (Looker SDK access plus auth methods). Sources that are not Looker sources fail the assertion and this error is returned, refusing to bind the tool to that source.

Source

Thrown at internal/tools/looker/lookerdeletegitbranch/lookerdeletegitbranch.go:116

// 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)
	}
	sdk, err := source.GetLookerSDK(ctx, string(accessToken))
	if err != nil {
		return nil, util.NewClientServerError(fmt.Sprintf("error getting sdk: %v", err), http.StatusInternalServerError, err)
	}

	mapParams := params.AsMap()
	projectId := mapParams["project_id"].(string)
	branch := mapParams["branch"].(string)
	if branch == "" {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's `source` to a configured Looker source (kind: looker).
  2. Verify source names in the config are unique and correctly referenced.
  3. Implement the full compatibleSource interface if supplying a custom source type.

Example fix

# before
source: my-bigquery

# after
source: my-looker
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := src.(interface {
	LookerApiSettings() *rtl.ApiSettings
	GetLookerSDK(context.Context, string) (*v4.LookerSDK, error)
}); !ok {
	return fmt.Errorf("source %T is not Looker-compatible; fix the tool's `source` field", src)
}

Type guard

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

Try / catch

if err := tool.ValidateSource(src); err != nil {
	return fmt.Errorf("looker-delete-gitbranch bound to wrong source: %w", err)
}

Prevention

When it happens

Trigger: Tool resolution at startup when the tool's `source` names a non-Looker source, or direct ValidateSource calls with an incompatible source instance.

Common situations: Config drift after editing sources; a tool referencing another database's source by mistake; custom sources missing GetLookerSDK or LookerApiSettings.

Related errors


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