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 of the looker-get-connection-tables tool returns this when the provided sources.Source does not implement its compatibleSource interface (UseClientAuthorization, GetAuthTokenHeaderName, LookerApiSettings). Only Looker sources satisfy it, so the error means the tool is attached to an incompatible source type.

Source

Thrown at internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables.go:108

// 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)
	}
	mapParams := params.AsMap()
	conn, ok := mapParams["conn"].(string)
	if !ok {
		return nil, util.NewAgentError(fmt.Sprintf("'conn' must be a string, got %T", mapParams["conn"]), nil)
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Bind the tool to a Looker (kind: looker) source in the config.
  2. Implement the full compatibleSource interface on custom sources.
  3. Use prebuilt Looker tool configs to guarantee tool/source compatibility.
  4. Fix interface drift after upgrades by implementing newly added methods.

Example fix

# before
source: my-bigquery-source
tools:
  tables: { kind: looker-get-connection-tables }
# after
sources:
  my-looker: { kind: looker, ... }
tools:
  tables: { kind: looker-get-connection-tables, source: my-looker }
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := src.(lookergetconnectiontables.CompatibleSource); !ok {
    return fmt.Errorf("looker-get-connection-tables requires a looker source; got %T", src)
}

Type guard

func isLookerSource(s sources.Source) bool {
    _, ok := s.(interface {
        UseClientAuthorization() bool
        GetAuthTokenHeaderName() string
        LookerApiSettings() *rtl.ApiSettings
    })
    return ok
}

Try / catch

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

Prevention

When it happens

Trigger: ValidateSource invoked at server startup or registration with a non-Looker source bound to this tool; a stub/test source missing one or more of the Looker interface methods.

Common situations: tools.yaml maps the tool to a Postgres/other source; refactors renamed sources; custom sources no longer satisfy the interface after an upgrade; test fakes implement only the base sources.Source interface.

Related errors


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