googleapis/mcp-toolbox · error

%d is an excluded value

Error message

%d is an excluded value

What it means

IntParameter.Parse rejects an integer because it appears in the parameter's excludedValues blacklist. Unlike allowedValues (a whitelist), excludedValues lets tool authors forbid specific known-bad numbers while allowing everything else. The value parsed fine as an int; it is simply on the forbidden list.

Source

Thrown at internal/util/parameters/parameters.go:821

		return nil, &ParseTypeError{p.Name, p.Type, v}
	case int:
		out = int(newV)
	case int32:
		out = int(newV)
	case int64:
		out = int(newV)
	case json.Number:
		newI, err := newV.Int64()
		if err != nil {
			return nil, &ParseTypeError{p.Name, p.Type, v}
		}
		out = int(newI)
	}
	if !p.IsAllowedValues(out) {
		return nil, fmt.Errorf("%d is not an allowed value", out)
	}
	if p.IsExcludedValues(out) {
		return nil, fmt.Errorf("%d is an excluded value", out)
	}
	if p.MinValue != nil && out < *p.MinValue {
		return nil, fmt.Errorf("%d is under the minimum value", out)
	}
	if p.MaxValue != nil && out > *p.MaxValue {
		return nil, fmt.Errorf("%d is above the maximum value", out)
	}
	return out, nil
}

func (p *IntParameter) GetAuthServices() []ParamAuthService {
	return p.AuthServices
}

func (p *IntParameter) GetDefault() any {
	if p.Default == nil {
		return nil
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Pick a different integer that is not in the parameter's excludedValues list (check the tool schema/manifest)
  2. If the value is actually legitimate, remove it from excludedValues in tools.yaml (or WithIntExcludedValues) and restart/redeploy the toolbox
  3. If 0 or -1 was intended as 'use default', omit the parameter so the configured default is applied instead

Example fix

// before
params := map[string]any{"page": 0} // excludedValues include 0
// after
params := map[string]any{"page": 1}
Defensive patterns

Strategy: validation

Validate before calling

excluded := []int{0, -1}
func validateNotExcluded(v int, excluded []int) error {
    for _, e := range excluded {
        if v == e { return fmt.Errorf("%d is excluded", v) }
    }
    return nil
}

Type guard

func isExcludedInt(v int, excluded []int) bool {
    for _, e := range excluded { if v == e { return true } }
    return false
}

Try / catch

out, err := tool.Parse(params)
if err != nil && strings.Contains(err.Error(), "is an excluded value") {
    // substitute a safe value or omit the param to use the default
}

Prevention

When it happens

Trigger: Invoking a tool with an integer that matches an entry in the IntParameter's excludedValues (yaml 'excludedValues:' or WithIntExcludedValues). Example: excludedValues [0] and the request passes 0.

Common situations: Blocking sentinel values like 0 or -1 that mean 'unset' upstream; excluding ids known to be invalid in a database; clients/default templates still sending a value that was later blacklisted in the tool config.

Related errors


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