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
Thrown by the cassandracql Tool.ValidateSource when the sources.Source passed in does not implement the tool's compatibleSource interface. This fails fast with a message identifying the tool and the offending source name before any CQL is executed.
Source
Thrown at internal/tools/cassandra/cassandracql/cassandracql.go:106
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
- Set the tool's source field to a cassandra source in tools.yaml
- Verify the referenced source name exists and is a Cassandra-compatible source
- Restart the toolbox to reload the configuration
- If invoking programmatically, pass the Cassandra source instance satisfying compatibleSource
Example fix
// before (tools.yaml)
sources:
my-db:
kind: postgres
uri: ...
tools:
cql-query:
kind: cassandra-cql
source: my-db
// after
sources:
my-cassandra:
kind: cassandra
hosts: [127.0.0.1]
tools:
cql-query:
kind: cassandra-cql
source: my-cassandra Defensive patterns
Strategy: type-guard
Validate before calling
// Pre-check the source before running the cql tool
if err := tool.ValidateSource(mySource); err != nil {
return fmt.Errorf("bad source-tool pairing for %s: %w", toolName, err)
} Type guard
func isCompatibleCassandraSource(s sources.Source) (cassandracql.CompatibleSource, bool) {
cs, ok := s.(cassandracql.CompatibleSource)
return cs, ok
} Prevention
- Point cassandra-cql tools only at cassandra sources
- Validate config at startup; the toolbox fails fast on incompatible pairs
- After renaming/deleting sources, update all tool references
- Write the error message's source name down — it names the offending source
When it happens
Trigger: Invoke/ValidateSource is called with a source whose concrete type fails the type assertion to cassandracql's compatibleSource — typically the tool's source field in tools.yaml references a non-Cassandra source.
Common situations: Pointing a cassandra-cql tool at a Postgres/MySQL/other source; renaming sources and missing a reference; programmatically pairing tools with sources of the wrong kind.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- source is not compatible with the tool
- source is not compatible with the tool
- source is not compatible with the tool
- source is not compatible with the tool
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/677e721f0f526f4a.
Report an issue: GitHub.