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 on the cloud-sql-create-database tool asserts the bound source implements `compatibleSource`; if the assertion fails it returns this error. Only Cloud SQL sources that can provide the SQL admin service and create-database operation are permitted. The error means the tool was bound to an incompatible source kind.
Source
Thrown at internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase.go:100
}
// Tool represents the create-database 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 executes the tool's logic.
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()
project, ok := paramsMap["project"].(string)
if !ok {
return nil, util.NewAgentError("missing 'project' parameter", nil)
}
instance, ok := paramsMap["instance"].(string)
if !ok {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source:` at a Cloud SQL source implementing compatibleSource (cloudsqlpg, cloudsqlmysql, cloudsqlmssql).
- Check the quoted source name and fix kind/name mismatches in the config.
- For custom sources, implement GetDefaultProject, GetService, UseClientAuthorization, and CreateDatabase.
- Reload config and verify startup validation succeeds.
Example fix
# before
tools:
create-database:
kind: cloud-sql-create-database
source: pg-source
# after
tools:
create-database:
kind: cloud-sql-create-database
source: cloudsql-pg-source Defensive patterns
Strategy: validation
Validate before calling
// Go: fail fast at config load
if err := tool.ValidateSource(src); err != nil {
log.Fatalf("create-database source invalid: %v", err)
} Try / catch
if err := tool.ValidateSource(source); err != nil {
return fmt.Errorf("cloud-sql-create-database bound to %T, expected a cloudsql* source: %w", source, err)
} Prevention
- Call ValidateSource during startup/config load.
- Pair cloud-sql-create-database exclusively with cloudsql* sources.
- Keep source names consistent and typo-checked between sections.
- Re-run validation after toolbox upgrades.
- Compare with the upstream prebuilt cloud-sql tool config.
When it happens
Trigger: Calling ValidateSource during tool/source binding with a sources.Source that does not implement the tool's compatibleSource interface — typically a `create-database` tool whose `source:` points at a non-Cloud-SQL source.
Common situations: tools.yml miswiring (postgres/mysql source named instead of cloudsql*); typos in source names; custom sources missing required methods; toolbox upgrades that expanded compatibleSource.
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/6edf4b08b94ea6d2.
Report an issue: GitHub.