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-list-instances verifies the attached source implements compatibleSource (GetDefaultProject, UseClientAuthorization, ListInstance). Failing that, the tool cannot operate against the AlloyDB Admin API and this error is returned. It surfaces at tool/source wiring validation time.
Source
Thrown at internal/tools/alloydb/alloydblistinstances/alloydblistinstances.go:101
}
// Tool represents the list-instances 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 string", nil)
}
location, ok := paramsMap["location"].(string)
if !ok {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's 'source' to an alloydb source name
- Confirm the source kind in the sources section of tools.yaml is alloydb
- Fix and re-validate the config before starting the server
Example fix
// before source: my-bigquery // after source: my-alloydb
Defensive patterns
Strategy: validation
Validate before calling
if _, ok := source.(interface {
GetDefaultProject() string
UseClientAuthorization() bool
ListInstance(context.Context, string, string, string) (any, error)
}); !ok {
return fmt.Errorf("source %T incompatible with alloydb-list-instances", source)
} Type guard
func isAlloyDBInstanceSource(s sources.Source) bool {
_, ok := s.(alloydblistinstances.CompatibleSource)
return ok
} Prevention
- Verify the source kind is alloydb in tools.yaml
- Run config validation before server start
- Avoid copy-pasting tool blocks across source kinds
When it happens
Trigger: ValidateSource called with any sources.Source other than the alloydb source — e.g. tools.yaml binds this tool to a postgres, mysql, or http source.
Common situations: Incorrect source reference in tools.yaml; copying tool definitions between source sections; refactoring source names without updating tool bindings.
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
- unable to get AlloyDB connection config: %w
- 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/2a1093ae1e2966c0.
Report an issue: GitHub.