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

Source-compatibility check in ValidateSource: the configured source does not implement the Firestore compatibleSource interface, so the query tool is bound to a source that cannot run Firestore queries.

Source

Thrown at internal/tools/firestore/firestorequery/firestorequery.go:128

var _ tools.Tool = Tool{}

// Tool represents the Firestore query 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
}

// OrderByConfig represents ordering configuration
type OrderByConfig struct {
	Field     string `json:"field"`
	Direction string `json:"direction"`
}

// GetDirection returns the Firestore direction constant
func (o *OrderByConfig) GetDirection() firestoreapi.Direction {
	if strings.EqualFold(o.Direction, "DESCENDING") || strings.EqualFold(o.Direction, "DESC") {
		return firestoreapi.Desc
	}
	return firestoreapi.Asc
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's `source:` at a firestore-kind source.
  2. Check that the referenced source definition exists and has `kind: firestore`.
  3. Pass the correct *firestore.Source when validating programmatically.

Example fix

// before
  query:
    kind: firestore-query
    source: my-postgres
// after
  query:
    kind: firestore-query
    source: my-firestore
Defensive patterns

Strategy: type-guard

Validate before calling

if err := queryTool.ValidateSource(src); err != nil {
	return fmt.Errorf("firestore-query bound to non-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("cannot invoke query tool: %w", err)
}

Prevention

When it happens

Trigger: Resolving or invoking the tool with a source whose concrete type does not satisfy compatibleSource.

Common situations: Tool bound to the wrong source name in YAML; swapping source kinds in shared configs without updating tool bindings.

Related errors


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