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
The serverlessspark-get-session tool throws this in its ValidateSource method when the bound source does not satisfy the tool's `compatibleSource` interface (a Serverless Spark source able to create session clients). The library validates tool/source compatibility at startup so misconfiguration is caught before any request. A type assertion failure means the named source exists but is of a different kind than the tool requires.
Source
Thrown at internal/tools/serverlessspark/serverlesssparkgetsession/serverlesssparkgetsession.go:128
res, err := source.GetSession(ctx, name)
if err != nil {
return nil, util.ProcessGcpError(err)
}
return res, nil
}
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
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source` at a `kind: serverless-spark` source in tools.yaml.
- Verify source name spelling and that the source block still exists with the serverless-spark kind.
- Remove or replace the tool if it no longer matches your intended source type.
Example fix
# before
tools:
get-session:
kind: serverless-spark-get-session
source: mysql-src
# after
tools:
get-session:
kind: serverless-spark-get-session
source: spark-src # kind: serverless-spark Defensive patterns
Strategy: validation
Validate before calling
tools:
get-session:
kind: serverless-spark-get-session
source: spark-src # source must be kind: serverless-spark Type guard
func isServerlessSparkSource(s sources.Source) bool {
_, ok := s.(serverlessspark.Source)
return ok
} Prevention
- Validate the tools file at CI time by launching the toolbox binary against it.
- Use distinct, descriptive source names to avoid binding tools to the wrong source.
- Keep tool definitions close to their source definitions in the YAML for reviewability.
When it happens
Trigger: A `serverless-spark-get-session` tool whose `source` field names a source whose concrete Go type is not the Serverless Spark source, so `source.(compatibleSource)` returns ok=false.
Common situations: tools.yaml with multiple sources where the tool references the wrong one; a refactored config where the Spark source was renamed/deleted and the name now resolves to another source; hand-edited YAML merging two example configs.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/2fc0cc2f4b86c5df.
Report an issue: GitHub.