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-get-dashboards confirms the attached source implements the Looker `compatibleSource` interface. When `source.(compatibleSource)` fails, the tool returns this error rather than proceeding, because Invoke needs Looker-specific source methods.

Source

Thrown at internal/tools/looker/lookergetdashboards/lookergetdashboards.go:114

// 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)
	}
	paramsMap := params.AsMap()
	title := paramsMap["title"].(string)
	title_ptr := &title
	if *title_ptr == "" {
		title_ptr = nil

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's `source:` to a looker-kind source in tools.yaml.
  2. Fix source name typos so the intended Looker source resolves.
  3. Implement compatibleSource on any custom source used with this tool.
  4. Validate the config at startup to surface the mismatch before traffic.

Example fix

// before
sources:
  my-http:
    kind: http
tools:
  list-dashboards:
    kind: looker-get-dashboards
    source: my-http
// after
sources:
  my-looker:
    kind: looker
tools:
  list-dashboards:
    kind: looker-get-dashboards
    source: my-looker
Defensive patterns

Strategy: type-guard

Validate before calling

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

Type guard

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

Try / catch

if err := tool.ValidateSource(src); err != nil {
    log.Fatalf("source incompatible with looker tool: %v", err)
}

Prevention

When it happens

Trigger: Tool validation (startup or pre-invoke) where the sources.Source bound to the looker-get-dashboards tool is of a non-Looker kind.

Common situations: Wrong `source:` key in tools.yaml; typos in the source name resolving to another source; a custom Source missing the Looker interface; config drift after renaming sources between environments.

Related errors


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