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-mongodb-execute-mql tools can only run against sources implementing the compatibleSource interface (FirestoreClient() and ExecuteMQL). During server startup, Toolbox calls ValidateSource with the source named in the tool's config; if that source's Go type doesn't implement the interface, this error is returned and the tool fails to load.

Source

Thrown at internal/tools/firestoremongodb/firestoremongodbexecutemql/firestoremongodbexecutemql.go:102

// 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()

	query, ok := mapParams[queryKey].(string)
	if !ok || query == "" {
		return nil, util.NewAgentError(fmt.Sprintf("parameter %q is required and must be a non-empty string", queryKey), nil)
	}

	logger, err := util.LoggerFromContext(ctx)
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set the tool's "source" field in tools.yaml to a source declared as kind "firestore-mongodb".
  2. Check the sources: section of tools.yaml and confirm the named source's kind matches the tool type.
  3. If the tool should target a different backend, change the tool "type" to one matching the existing source instead.

Example fix

# before
tools:
  run-query:
    type: firestore-mongodb-execute-mql
    source: my-postgres-src
    description: Run MQL
# after
tools:
  run-query:
    type: firestore-mongodb-execute-mql
    source: my-firestore-mongodb-src
    description: Run MQL
Defensive patterns

Strategy: validation

Validate before calling

// Before starting the toolbox, check tool/source pairing in tools.yaml
for _, tool := range cfg.Tools {
    if tool.Type == "firestore-mongodb-execute-mql" {
        src, ok := cfg.Sources[tool.Source]
        if !ok || src.Kind != "firestore-mongodb" {
            return fmt.Errorf("tool %q requires a firestore-mongodb source, got %q", tool.Name, tool.Source)
        }
    }
}

Type guard

func isFirestoreMongoDBSource(s sources.Source) bool {
    _, ok := s.(interface {
        FirestoreClient() *firestore.Client
        ExecuteMQL(context.Context, string) (any, error)
    })
    return ok
}

Prevention

When it happens

Trigger: A tool of type "firestore-mongodb-execute-mql" in tools.yaml references a "source" field pointing at a source that is not a Firestore MongoDB compatible source (e.g., a postgres, http, or plain firestore source), so the type assertion source.(compatibleSource) fails.

Common situations: Copy-pasting a tool block between tool configs and forgetting to update the source name; pointing several tools at one source name that was later redefined to a different kind; typos in the source name that silently resolve to a differently-typed source.

Related errors


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