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-alloydbcreateinstance asserts the bound sources.Source implements compatibleSource (an AlloyDB admin source exposing UseClientAuthorization and GetDefaultProject). Any other source kind fails the assertion and yields this error, preventing the tool from running against an incompatible source.

Source

Thrown at internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance.go:101

}

// Tool represents the create-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 || 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

  1. Set the tool's `source` to a kind: alloydb admin source
  2. Cross-check the `sources:` block to confirm the referenced kind
  3. Re-run the toolbox and verify clean tool registration

Example fix

// before
source: alloydb-postgres-source
// after
source: alloydb-admin-source
Defensive patterns

Strategy: validation

Validate before calling

if err := tool.ValidateSource(src); err != nil {
  log.Fatal(err)
}

Type guard

func isCompatible(s sources.Source) bool {
  _, ok := s.(compatibleSource)
  return ok
}

Try / catch

if err := tool.ValidateSource(src); err != nil {
  return fmt.Errorf("reconfigure tool source: %w", err)
}

Prevention

When it happens

Trigger: alloydb-alloydbcreateinstance configured with a `source` that is not the AlloyDB admin source; triggered during startup validation or before Invoke.

Common situations: Binding the instance-creation tool to an alloydb-postgres (SQL) source instead of the admin source; shared config templates where `source:` was not updated.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/67b83eac04595be7. Report an issue: GitHub.