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 for cloudsql-clone-instance asserts the source implements the tool's compatibleSource interface (a Cloud SQL Admin source). A source of any other Go type fails the assertion, returning this error. The tool needs Cloud SQL Admin capabilities (project/instance access) that only the compatible source provides.
Source
Thrown at internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance.go:102
}
// Tool represents the clone-instance 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(fmt.Sprintf("error casting 'project' parameter: %v", paramsMap["project"]), nil)
}
sourceInstanceName, ok := paramsMap["sourceInstanceName"].(string)
if !ok {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's `source` at a cloud-sql (admin) kind source.
- Run config validation before starting the server to catch the mismatch.
- For custom wrappers, implement the full compatibleSource interface.
- Verify the source kind under `sources:` actually supports instance cloning operations.
Example fix
// before
clone-instance:
kind: cloud-sql-clone-instance
source: my-postgres
// after
clone-instance:
kind: cloud-sql-clone-instance
source: cloud-sql-admin Defensive patterns
Strategy: validation
Validate before calling
// Go: validate the Cloud SQL source before tool use
if err := cloneTool.ValidateSource(src); err != nil {
return fmt.Errorf("clone-instance requires a cloud-sql admin source: %w", err)
} Type guard
func asCloudSQLSource(s sources.Source) (compatibleSource, bool) {
cs, ok := s.(compatibleSource)
return cs, ok
} Try / catch
if err := cloneTool.ValidateSource(src); err != nil {
log.Fatalf("cloud-sql-clone-instance misconfigured: %v", err)
} Prevention
- Distinguish the Cloud SQL Admin source from engine connection sources in tools.yaml and bind clone-instance to the former.
- Validate bindings at startup and in CI.
- Keep custom source wrappers implementing compatibleSource with compile-time assertions.
- After version upgrades, confirm the compatibleSource interface hasn't gained methods.
When it happens
Trigger: Config validation or Invoke-time checks where the clone-instance tool is bound to a non-Cloud SQL source, e.g. a plain postgres/mysql source instead of cloud-sql admin, or a custom source missing the interface methods.
Common situations: Binding the tool to the database connection source rather than the Cloud SQL Admin source; renaming sources and updating tool bindings incorrectly; interface changes after a toolbox upgrade.
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/7154c709ce6d4b45.
Report an issue: GitHub.