googleapis/mcp-toolbox · error

must provide one of: 'tns_alias', 'connection_string', or bo

Error message

must provide one of: 'tns_alias', 'connection_string', or both 'host' and 'service_name'

What it means

Oracle Config.validate counts the available connection methods (tnsAlias, connectionString, host+serviceName); if none is provided the source cannot build a connection and returns this explicit message.

Source

Thrown at internal/sources/oracle/oracle.go:81

	hasTnsAdmin := strings.TrimSpace(c.TnsAdmin) != ""
	hasTnsAlias := strings.TrimSpace(c.TnsAlias) != ""
	hasConnStr := strings.TrimSpace(c.ConnectionString) != ""
	hasHostService := strings.TrimSpace(c.Host) != "" && strings.TrimSpace(c.ServiceName) != ""
	hasWallet := strings.TrimSpace(c.WalletLocation) != ""

	connectionMethods := 0
	if hasTnsAlias {
		connectionMethods++
	}
	if hasConnStr {
		connectionMethods++
	}
	if hasHostService {
		connectionMethods++
	}

	if connectionMethods == 0 {
		return fmt.Errorf("must provide one of: 'tns_alias', 'connection_string', or both 'host' and 'service_name'")
	}

	if connectionMethods > 1 {
		return fmt.Errorf("provide only one connection method: 'tns_alias', 'connection_string', or 'host'+'service_name'")
	}

	if hasTnsAdmin && !c.UseOCI {
		return fmt.Errorf("`tnsAdmin` can only be used when `UseOCI` is true, or use `walletLocation` instead")
	}

	if hasWallet && c.UseOCI {
		return fmt.Errorf("when using an OCI driver, use `tnsAdmin` to specify credentials file location instead")
	}

	return nil
}

func (r Config) SourceConfigType() string {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Add one connection method to the config: tnsAlias, or connectionString, or both host and serviceName
  2. Verify YAML keys are correctly spelled and nested (not swallowed by indentation)
  3. Confirm the decoded section actually receives these fields (matching yaml tags)

Example fix

// before
kind: oracle
user: app
password: secret
# no connection info
// after
kind: oracle
user: app
password: secret
host: db.example.com
serviceName: ORCL
Defensive patterns

Strategy: validation

Validate before calling

func hasConnectionMethod(cfg map[string]any) bool {
    if _, ok := cfg["tnsAlias"]; ok { return true }
    if _, ok := cfg["connectionString"]; ok { return true }
    _, h := cfg["host"]; _, s := cfg["serviceName"]
    return h && s
}

Prevention

When it happens

Trigger: Declaring an Oracle source config with only credentials (user/password) or tnsAdmin but no tnsAlias, connectionString, or host+serviceName pair.

Common situations: Skeleton configs left unfilled; users assuming a tnsAdmin/wallet alone is enough to connect; deleted host field during refactoring.

Related errors


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