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-template tool throws this from ValidateSource when the configured source fails the `compatibleSource` type assertion, i.e. it is not a Serverless Spark source with the required session-template client method. Toolbox enforces this check when the tool is initialized against its configured source so incompatible pairings never reach Invoke.
Source
Thrown at internal/tools/serverlessspark/serverlesssparkgetsessiontemplate/serverlesssparkgetsessiontemplate.go:128
res, err := source.GetSessionTemplate(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
- Change the tool's `source` to the name of a `serverless-spark` kind source.
- Add a `kind: serverless-spark` source to tools.yaml if none exists, then reference it.
- Audit all serverless-spark-* tools' source fields when refactoring the sources section.
Example fix
# before
tools:
get-template:
kind: serverless-spark-get-session-template
source: bq-src
# after
tools:
get-template:
kind: serverless-spark-get-session-template
source: spark-src Defensive patterns
Strategy: validation
Validate before calling
sources:
spark-src:
kind: serverless-spark
tools:
get-template:
kind: serverless-spark-get-session-template
source: spark-src Type guard
func isServerlessSparkSource(s sources.Source) bool {
_, ok := s.(serverlessspark.Source)
return ok
} Prevention
- Never share a single `source:` anchor across tools of different kinds.
- Review the sources section whenever adding serverless-spark-* tools.
- Start the server locally before deploying; Toolbox surfaces the exact tool and source name in this error.
When it happens
Trigger: Declaring a `serverless-spark-get-session-template` tool whose `source` references a non-serverless-spark source (e.g. postgres, bigquery, http), making the interface assertion in ValidateSource fail.
Common situations: Reusing a single shared `source:` anchor across tools of different kinds; template scaffolding that left a placeholder source name; team members adding tools without a matching Spark source in the environment.
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/8339ba868db454d1.
Report an issue: GitHub.