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 at config-load time that the tool's declared source implements the compatibleSource interface (the Looker source). This error means the source named by the tool either is not a Looker source or does not exist as a compatible type, so the tool cannot operate against it.

Source

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

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

var (
	dataType string = "data"
	visType  string = "vis"
)

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. Point the tool's source field at a source defined with kind: looker
  2. Add a looker source to the config and reference it from this tool
  3. Fix the source name typo so it matches an existing Looker source entry

Example fix

// before
tools:
  add_tile:
    kind: looker-add-dashboard-element
    source: my_pg
// after
tools:
  add_tile:
    kind: looker-add-dashboard-element
    source: my_looker
Defensive patterns

Strategy: validation

Validate before calling

if _, ok := source.(lookercommon.LookerAPI); !ok {
    return errors.New("tool requires a looker source")
}

Type guard

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

Try / catch

if err := tool.ValidateSource(src); err != nil {
    // bind the tool to a kind: looker source and reload config
    return err
}

Prevention

When it happens

Trigger: A tools.yaml looker-add-dashboard-element tool references source: my-postgres (or any non-Looker source), or references a source name that maps to an incompatible source kind; ValidateSource is called during config validation.

Common situations: Copy-pasting a tool block from a looker toolset into a config whose sources are databases; renaming the source in sources: but not updating the tool's source field; YAML typo so the tool points at the wrong source entry.

Related errors


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