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 for the Firestore add-documents tool fails when the injected source does not implement the Firestore compatibleSource interface. The message shows the tool type and the configured source name, indicating a source-kind mismatch.

Source

Thrown at internal/tools/firestore/firestoreadddocuments/firestoreadddocuments.go:136

// 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()
	// Get collection path
	collectionPath, ok := mapParams[collectionPathKey].(string)
	if !ok || collectionPath == "" {
		return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter", collectionPathKey), nil)
	}
	// Validate collection path
	if err := fsUtil.ValidateCollectionPath(collectionPath); err != nil {
		return nil, util.NewAgentError(fmt.Sprintf("invalid collection path: %v", err), err)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set 'source' to a Firestore source (kind: firestore).
  2. Check the sources section for the correct source name/kind pairing.
  3. Reload the server and confirm tools initialize without validation errors.

Example fix

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

Strategy: validation

Validate before calling

# Verify Firestore tool binding
src = cfg['sources'][tool['source']]
assert src['kind'] == 'firestore', "firestore-add-documents requires a firestore source"

Try / catch

if err := tool.ValidateSource(src); err != nil {
    log.Fatalf("bad source for firestore tool: %v", err)
}

Prevention

When it happens

Trigger: Config assigns a non-Firestore source (e.g., a SQL database) to a firestore-add-documents tool; or the source name resolves to an incompatible source implementation at runtime.

Common situations: Wiring Firestore tools to Cloud SQL or other sources by mistake; typos in source names; reusing tool templates across source kinds.

Related errors


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