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 alloydb-alloydbcreateuser asserts the bound source implements compatibleSource (an AlloyDB admin source exposing UseClientAuthorization and GetDefaultProject). A source of any other type fails the assertion and produces this error, blocking the user-creation tool from running against an unsupported source.
Source
Thrown at internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser.go:101
}
// Tool represents the create-user 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 || project == "" {
return nil, util.NewAgentError("invalid or missing 'project' parameter; expected a non-empty string", nil)
}
location, ok := paramsMap["location"].(string)
if !ok || location == "" {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set `source` to a kind: alloydb admin source
- Verify the referenced source's kind in the YAML `sources:` block
- Restart and confirm clean tool registration in the logs
Example fix
// before source: postgres-prod // after source: alloydb-admin-prod
Defensive patterns
Strategy: validation
Validate before calling
if err := tool.ValidateSource(src); err != nil {
log.Fatal(err)
} Type guard
func isAdminSource(s sources.Source) bool {
_, ok := s.(compatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
return fmt.Errorf("bad source for create-user: %w", err)
} Prevention
- Pair each admin tool with an admin source explicitly
- Verify source kinds in the sources: block
When it happens
Trigger: alloydb-alloydbcreateuser configured with a `source` that is not the AlloyDB admin source; triggered during startup validation or right before Invoke.
Common situations: Pointing the tool at an alloydb-postgres or postgres source; template reuse where `source:` wasn't updated; a typo landing on the wrong source entry.
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
- error getting parameters for tool: %w
- error creating AlloyDB instance: %w
- error creating AlloyDB user: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/48bce4b0f9dba0ac.
Report an issue: GitHub.