googleapis/mcp-toolbox · error
%g is an excluded value
Error message
%g is an excluded value
What it means
FloatParameter.Parse rejects a float because it appears in the parameter's excludedValues blacklist. This lets tool authors forbid specific known-bad decimal values (e.g. 0.0 as an invalid factor) while allowing all others. The value is a valid float; it is simply forbidden by config.
Source
Thrown at internal/util/parameters/parameters.go:929
switch newV := v.(type) {
default:
return nil, &ParseTypeError{p.Name, p.Type, v}
case float32:
out = float64(newV)
case float64:
out = newV
case json.Number:
newI, err := newV.Float64()
if err != nil {
return nil, &ParseTypeError{p.Name, p.Type, v}
}
out = float64(newI)
}
if !p.IsAllowedValues(out) {
return nil, fmt.Errorf("%g is not an allowed value", out)
}
if p.IsExcludedValues(out) {
return nil, fmt.Errorf("%g is an excluded value", out)
}
if p.MinValue != nil && out < *p.MinValue {
return nil, fmt.Errorf("%g is under the minimum value", out)
}
if p.MaxValue != nil && out > *p.MaxValue {
return nil, fmt.Errorf("%g is above the maximum value", out)
}
return out, nil
}
func (p *FloatParameter) GetAuthServices() []ParamAuthService {
return p.AuthServices
}
func (p *FloatParameter) GetDefault() any {
if p.Default == nil {
return nil
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Resend with a float not in the excludedValues list (check the tool's parameter schema)
- If 0.0 meant 'use default', omit the parameter so the configured default applies
- If the value is legitimate, remove it from excludedValues in tools.yaml (or WithFloatExcludedValues) and redeploy
Example fix
// before
params := map[string]any{"factor": 0.0} // excludedValues include 0.0
// after
params := map[string]any{"factor": 1.0} Defensive patterns
Strategy: validation
Validate before calling
excluded := []float64{0.0}
func validateNotExcludedFloat(v float64, excluded []float64) error {
for _, e := range excluded {
if v == e { return fmt.Errorf("%g is excluded", v) }
}
return nil
} Type guard
func isExcludedFloat(v float64, excluded []float64) 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
- Avoid sending blacklisted sentinels (0.0, negatives) — omit the parameter instead
- Check excludedValues in the manifest before computed values are sent
- Document forbidden floats in the parameter description
- Review excludedValues on every tool config change
When it happens
Trigger: Invoking a tool with a float that matches an entry in the FloatParameter's excludedValues (yaml 'excludedValues:' or WithFloatExcludedValues). Example: excludedValues [0.0] and the request passes 0.0.
Common situations: Blocking zero/negative multipliers that would break SQL; excluding NaN-like sentinels; defaults or templates still emitting a value that was later blacklisted.
Related errors
- %g is not an allowed value
- unable to process parameters: %w
- %d is not an allowed value
- %d is an excluded value
- %d is under the minimum value
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/1ab4b3909695bd82.
Report an issue: GitHub.