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 type-asserts the resolved source into the tool's compatibleSource interface and fails when the source named in the tool config does not implement it (i.e., is not a Cloud Gemini Data Analytics compatible source). This runs at config load so incompatible tool/source pairings are rejected before serving.

Source

Thrown at internal/tools/cloudgda/cloudgda.go:170

// 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)
	}
	paramsMap := params.AsMap()
	query, ok := paramsMap["query"].(string)
	if !ok {
		return nil, util.NewAgentError("query parameter not found or not a string", nil)
	}

	// Parse the access token if provided
	var tokenStr string
	if source.UseClientAuthorization() {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's source field to a source whose kind is a compatible Cloud Gemini Data Analytics source (e.g. cloud-gemini-data-analytics type sources)
  2. Check the source's kind in tools.yaml matches one accepted by the cloudgda tool
  3. Register or use a source implementing UseClientAuthorization()/the compatibleSource interface if building a custom source

Example fix

// before
tools:
  gda-q:
    kind: cloud-gemini-data-analytics-query
    source: my-postgres
// after
tools:
  gda-q:
    kind: cloud-gemini-data-analytics-query
    source: my-gda-source
Defensive patterns

Strategy: validation

Validate before calling

// check tool/source pairing before starting the server
func sourceKindOK(tool map[string]any, compatibleKinds []string) bool {
	kind := tool["source_kind"] // resolved from sources block
	for _, k := range compatibleKinds { if k == kind { return true } }
	return false
}

Prevention

When it happens

Trigger: Pointing a cloud-gemini-data-analytics tool at a source of a different kind (e.g. postgres, bigquery-sql) in tools.yaml.

Common situations: Copy-pasting a tool definition from another integration and only changing the name, not the source; renaming sources and pointing the tool at the wrong one; expecting cloudgda to work with generic SQL sources.

Related errors


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