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 mindsdb-execute-sql checks that the attached source implements compatibleSource (the MindsDB source interface). If the type assertion fails, the tool rejects the source because it cannot execute SQL against it. This is a startup/config-time compatibility check between tool and source kinds.

Source

Thrown at internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql.go:99

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

	resp, err := source.RunSQL(ctx, sqlStr, nil)
	if err != nil {
		return nil, util.ProcessGeneralError(err)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's `source` field at a MindsDB source (kind: mindsdb)
  2. Confirm the source name matches the entry under `sources:` in tools.yaml
  3. Restart/validate the toolbox config to confirm all bindings pass

Example fix

// before
tools:
  exec:
    kind: mindsdb-execute-sql
    source: my-alloydb
// after
tools:
  exec:
    kind: mindsdb-execute-sql
    source: my-mindsdb
Defensive patterns

Strategy: validation

Validate before calling

if err := tool.ValidateSource(sourcesMap[toolCfg.Source]); err != nil {
    log.Fatalf("config invalid: %v", err)
}

Prevention

When it happens

Trigger: Binding the mindsdb-execute-sql tool to a source of the wrong kind (e.g. a postgres or http source); the server calls ValidateSource when wiring tools to sources.

Common situations: Wrong source name in the tool's `source` field; source renamed or replaced with a different kind; copy-pasted tool definitions pointing at another database's source.

Related errors


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