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-list-sessions tool throws this from ValidateSource when the source attached to the tool is not a Serverless Spark source implementing `compatibleSource`. The error surfaces during configuration loading/initialization because Toolbox validates each tool against its source before serving, ensuring the tool can construct the Dataproc session client it needs.
Source
Thrown at internal/tools/serverlessspark/serverlesssparklistsessions/serverlesssparklistsessions.go:132
res, err := source.ListSessions(ctx, pageSize, pt, filter)
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 `source:` at a `kind: serverless-spark` source.
- Correct the source name typo or restore the missing serverless-spark source entry.
- Regenerate/validate the tools.yaml with the Toolbox dev UI to confirm every tool/source pairing passes ValidateSource.
Example fix
# before
tools:
list-sessions:
kind: serverless-spark-list-sessions
source: dataproc-src
# after
tools:
list-sessions:
kind: serverless-spark-list-sessions
source: serverless-spark-src Defensive patterns
Strategy: validation
Validate before calling
tools:
list-sessions:
kind: serverless-spark-list-sessions
source: spark-src # kind: serverless-spark required Type guard
func isServerlessSparkSource(s sources.Source) bool {
_, ok := s.(serverlessspark.Source)
return ok
} Prevention
- Verify tool/source pairings after any YAML restructure or merge.
- Use the toolbox dev UI to load configs interactively and see validation errors immediately.
- Keep integration-specific tools in separate config files to reduce cross-binding mistakes.
When it happens
Trigger: Configuring `serverless-spark-list-sessions` with a `source` that resolves to a different source implementation, causing `source.(compatibleSource)` to fail in serverlesssparklistsessions.go.
Common situations: Wrong source name after copying a tool definition from another integration's docs; sources section reorganized and the Spark source key changed; YAML anchors/merging binding one source to many mismatched tools.
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/32bbc1484232afe0.
Report an issue: GitHub.