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

firestore-get-rules' ValidateSource type-asserts the incoming sources.Source to compatibleSource. Any source that is not the Firestore source (e.g., a SQL database source) fails the assertion and yields this error before any rules API call.

Source

Thrown at internal/tools/firestore/firestoregetrules/firestoregetrules.go:101

// 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)
	}
	resp, err := source.GetRules(ctx)
	if err != nil {
		return nil, util.ProcessGcpError(err)
	}
	return resp, nil
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's `source:` to a firestore-kind source.
  2. Confirm the referenced source's kind is firestore, not another database engine.

Example fix

// before
  get_rules:
    kind: firestore-get-rules
    source: my-bigquery
// after
  get_rules:
    kind: firestore-get-rules
    source: my-firestore
Defensive patterns

Strategy: type-guard

Validate before calling

if err := getRulesTool.ValidateSource(fsSource); err != nil {
	return fmt.Errorf("get-rules needs a firestore source: %w", err)
}

Type guard

func isCompatibleFirestoreSource(s sources.Source) bool {
	_, ok := s.(firestore.CompatibleSource)
	return ok
}

Try / catch

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

Prevention

When it happens

Trigger: Invoking or validating the tool with a non-Firestore sources.Source.

Common situations: Misconfigured `source:` reference in YAML; reusing the same tool entry across different source kinds.

Related errors


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