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 a Go type assertion of the configured source against the tool's compatibleSource interface (Looker API access). The error fires at server startup when the tool's 'source' references a source kind (e.g. postgres, cloudstorage) that does not implement the Looker-compatible interface, meaning the tool/source pairing in tools.yaml is invalid.

Source

Thrown at internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases.go:106

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

	sdk, err := source.GetLookerSDK(ctx, string(accessToken))
	if err != nil {
		return nil, util.NewClientServerError("error getting sdk", http.StatusInternalServerError, err)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's 'source' field to the name of a Looker source defined in the sources section of tools.yaml
  2. Verify the source kind is 'looker' and not another database/source type
  3. Check for typos in the source name that silently matched a different source
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases.go:106 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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