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 performs an assertion that the provided sources.Source implements the compatibleSource interface (the Looker source with Client()). If it does not, the tool cannot operate on that source, so it returns this error naming the tool's configured source type.

Source

Thrown at internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter.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)
	}
	logger.DebugContext(ctx, "params = ", params)

	paramsMap := params.AsMap()
	dashboard_id, ok := paramsMap["dashboard_id"].(string)
	if !ok {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's 'source' field to a Looker source (looker-source kind).
  2. Check the tools.yaml so the tool is bound to the intended source name.
  3. Confirm the source initializes as a Looker source; re-register it if the kind was wrong.

Example fix

// before
tools:
  add-filter:
    kind: looker-add-dashboard-filter
    source: my-postgres
// after
tools:
  add-filter:
    kind: looker-add-dashboard-filter
    source: my-looker
Defensive patterns

Strategy: validation

Validate before calling

// In Go, assert compatibility before wiring the tool
if _, ok := src.(lookercommon.CompatibleSource); !ok {
    return fmt.Errorf("tool requires a looker source, got %T", src)
}

Type guard

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

Try / catch

if err := tool.ValidateSource(src); err != nil {
    return fmt.Errorf("source binding error: %w", err)
}

Prevention

When it happens

Trigger: Binding looker-add-dashboard-filter to a source whose concrete type does not implement compatibleSource (e.g., a Postgres or non-Looker source).

Common situations: Copy-pasting a tool definition and pointing it at the wrong source; YAML indentation placing the tool under the wrong source; renaming a source without updating tool bindings.

Related errors


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