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 checks that the source wired to the scylla-cql tool implements the compatibleSource interface (i.e. is a ScyllaDB/ScyllaDB-compatible source exposing a CQL session). If the configured source is of a different type (e.g. a Postgres source), initialization fails with this error. It is a startup-time type-compatibility guard, not a runtime query failure.

Source

Thrown at internal/tools/scylladb/scyllacql/scyllacql.go:102

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
}

// Invoke implements tools.Tool.
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()
	newStatement, err := parameters.ResolveTemplateParams(t.Cfg.TemplateParameters, t.Cfg.Statement, paramsMap)
	if err != nil {
		return nil, util.NewAgentError("unable to extract template params", err)
	}

	newParams, err := parameters.GetParams(t.Cfg.Parameters, paramsMap)
	if err != nil {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Open the tools config YAML and confirm the tool's 'source:' field references a source whose 'kind' is scylladb
  2. Fix the source reference so the scylla-cql tool points at a ScyllaDB source
  3. Restart the server and confirm initialization succeeds

Example fix

# before
sources:
  db:
    kind: postgres
    uri: ...
tools:
  do-cql:
    source: db
# after
sources:
  db:
    kind: scylladb
    addresses: [...]
tools:
  do-cql:
    source: db
Defensive patterns

Strategy: type-guard

Validate before calling

// Go caller can pre-verify the source implements the compatible interface
if _, ok := src.(scyllacql.CompatibleSource); !ok {
    return fmt.Errorf("source %T cannot back a scylla-cql tool", src)
}
err := tool.ValidateSource(src)

Type guard

func isCompatibleScyllaSource(s sources.Source) bool {
    _, ok := s.(scyllacql.CompatibleSource)
    return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
    log.Fatalf("bind failed, check 'source:' kind in YAML: %v", err)
}

Prevention

When it happens

Trigger: At toolbox startup, a tool config maps tool 'type: scylla-cql' to a source whose Go type does not implement compatibleSource — for example pointing the tool at a postgres, mysql, or cloud-sql source instead of a scylladb source.

Common situations: Copy-pasting a prebuilt config and forgetting to change the source reference; renaming sources so the tool binds to the wrong source entry; mixing source kinds in one YAML file.

Related errors


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