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

The restore-backup tool's ValidateSource guard rejected the configured source because it does not implement compatibleSource — the tool is bound in tools.yaml to a source that is not a Cloud SQL source of the expected kind.

Source

Thrown at internal/tools/cloudsql/cloudsqlrestorebackup/cloudsqlrestorebackup.go:104

func buildParams(project string) parameters.Parameters {
	projectParam := parameters.NewStringParameter("target_project", "The project ID")
	if project != "" {
		projectParam = parameters.NewStringParameter("target_project", "The GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.", parameters.WithStringDefault(project))
	}
	return parameters.Parameters{
		projectParam,
		parameters.NewStringParameter("target_instance", "Cloud SQL instance ID of the target instance. This does not include the project ID."),
		parameters.NewStringParameter("backup_id", "Identifier of the backup being restored. Can be a BackupRun ID, backup name, or BackupDR backup name. Use the full backup ID as provided, do not try to parse it"),
		parameters.NewStringParameter("source_project", "GCP project ID of the instance that the backup belongs to. Only required if the backup_id is a BackupRun ID.", parameters.WithStringRequired(false)),
		parameters.NewStringParameter("source_instance", "Cloud SQL instance ID of the instance that the backup belongs to. Only required if the backup_id is a BackupRun ID.", parameters.WithStringRequired(false)),
	}
}

// resolveParams builds the tool's parameters using the source's configured default GCP project.
func (t Tool) resolveParams(source sources.Source) (parameters.Parameters, error) {
	s, ok := source.(compatibleSource)
	if !ok {
		return nil, fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", t.Cfg.Type, t.Cfg.Source)
	}
	return buildParams(s.GetDefaultProject()), nil
}

// GetParameters returns the tool's parameters, resolved against the source.
func (t Tool) GetParameters(source sources.Source) (parameters.Parameters, error) {
	return t.resolveParams(source)
}

// Manifest returns the tool's manifest, resolved against the source.
func (t Tool) Manifest(source sources.Source) (tools.Manifest, error) {
	allParameters, err := t.resolveParams(source)
	if err != nil {
		return tools.Manifest{}, err
	}
	return tools.Manifest{Description: t.Cfg.Description, Parameters: allParameters.Manifest(), AuthRequired: t.Cfg.AuthRequired}, nil
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool's `source` at a compatible Cloud SQL source
  2. Check the source name for typos
  3. Verify the source `type` matches what this tool requires
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/tools/cloudsql/cloudsqlrestorebackup/cloudsqlrestorebackup.go:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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