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

ValidateSource for falkordb-execute-cypher performs a type assertion of the injected source to `compatibleSource`; only FalkorDB sources satisfy it. When the bound source is a different implementation, the tool returns this error instead of attempting to run Cypher against an unsupported backend.

Source

Thrown at internal/tools/falkordb/falkordbexecutecypher/falkordbexecutecypher.go:120

// 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()
	cypherStr, ok := paramsMap["cypher"].(string)
	if !ok {
		return nil, util.NewAgentError(fmt.Sprintf("unable to cast cypher parameter %s", paramsMap["cypher"]), nil)
	}

	if cypherStr == "" {
		return nil, util.NewAgentError("parameter 'cypher' must be a non-empty string", nil)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Rebind the tool to a `falkordb`-kind source
  2. Audit all tools in the file for source references after any source rename
  3. If a compatible wrapper source is intended, use the correct source kind that implements the FalkorDB interface
  4. Restart the server so ValidateSource runs against the corrected config

Example fix

// before (tools.yaml)
tools:
  exec-cypher:
    kind: falkordb-execute-cypher
    source: neo4j-src
// after
tools:
  exec-cypher:
    kind: falkordb-execute-cypher
    source: falkordb-src
Defensive patterns

Strategy: validation

Validate before calling

// falkordb-execute-cypher requires kind == "falkordb"
if tool.SourceKind != "falkordb" {
    return fmt.Errorf("execute-cypher tool bound to %q source; expected falkordb", tool.SourceName)
}

Type guard

if fdbSrc, ok := src.(falkordbexecutecypher.CompatibleSource); ok {
    _ = fdbSrc
} else {
    return fmt.Errorf("source %T incompatible with falkordb-execute-cypher", src)
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
    return fmt.Errorf("config error: %s must reference the falkordb source: %w", toolName, err)
}

Prevention

When it happens

Trigger: A `falkordb-execute-cypher` tool whose `source` field references a non-FalkorDB source in tools.yaml or via the programmatic sources map.

Common situations: Composing configs from multiple teams where source names overlap; migrating from another graph DB (e.g. Neo4j) and reusing the old source binding; copying prebuilt config fragments without adjusting source names.

Related errors


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