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

Tool.ValidateSource checks that the source bound to the conversational analytics tool implements the compatibleSource interface (a BigQuery-family source). If the configured source is of a different kind, the tool cannot obtain the client it needs, so it rejects the binding at initialization/validation time.

Source

Thrown at internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics.go:161

// 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)
	}
	var tokenSource oauth2.TokenSource
	var err error
	// Get credentials for the API call
	if source.UseClientAuthorization() {
		// Use client-side access token
		if accessToken == "" {
			return nil, util.NewClientServerError("tool is configured for client OAuth but no token was provided in the request header", http.StatusUnauthorized, nil)
		}
		tokenStr, err := accessToken.ParseBearerToken()

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's source field at a BigQuery-compatible source (e.g. a bigquery source kind)
  2. Verify source kind and tool kind match in the YAML config
  3. If wrapping a managed source, use a source type that implements the BigQuery client interface

Example fix

// before
tools:
  ask-data:
    kind: bigquery-conversational-analytics
    source: my-postgres-source
// after
tools:
  ask-data:
    kind: bigquery-conversational-analytics
    source: my-bigquery-source
Defensive patterns

Strategy: type-guard

Validate before calling

// check the source kind matches before binding
desiredSource := "my-bigquery-source"
src := sources[desiredSource]
if src == nil || src.SourceType() != "bigquery" {
    return fmt.Errorf("source %q is not a BigQuery-compatible source", desiredSource)
}

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: A bigquery-conversational-analytics tool's config references a source whose type is not a compatible BigQuery source (e.g. a postgres or cloud-sql source), producing this error when ValidateSource runs.

Common situations: Copy-pasting a tool definition and leaving another source's name in the source field; mixing sources and tools of different engines in one YAML; renaming sources and pointing the tool at the wrong one.

Related errors


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