googleapis/mcp-toolbox · error

%g is under the minimum value

Error message

%g is under the minimum value

What it means

FloatParameter.Parse rejects a float because it is below the parameter's configured minValue. The value parsed as a valid float but fails the lower-bound range check set by the tool author (e.g. probabilities must be >= 0, factors > 0). Expected toolbox input validation.

Source

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

	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
	}
	return *p.Default
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Resend with a float >= the configured minValue (see the tool's parameter manifest/description)
  2. Clamp client-side before invoking, e.g. math.Max(minValue, value)
  3. Fix upstream computation/unit conversion if values legitimately fall below the bound
  4. If the bound is too strict, lower or remove minValue in tools.yaml (or WithFloatMinValue) and redeploy

Example fix

// before
params := map[string]any{"probability": -0.1} // minValue is 0
// after
params := map[string]any{"probability": 0.0}
Defensive patterns

Strategy: validation

Validate before calling

func validateMinFloat(v, minValue float64) error {
    if v < minValue {
        return fmt.Errorf("%g is below minimum %g", v, minValue)
    }
    return nil
}
// usage: validateMinFloat(probability, 0.0)

Type guard

func withinMinFloat(v, minValue float64) bool { return v >= minValue }

Try / catch

out, err := tool.Parse(params)
if err != nil && strings.Contains(err.Error(), "is under the minimum value") {
    // clamp: params[key] = minValue from manifest and retry once
}

Prevention

When it happens

Trigger: Invoking a tool with a float smaller than minValue configured via yaml 'minValue:' or WithFloatMinValue. Example: minValue 0.0 and the request passes -0.5.

Common situations: LLMs producing negative probabilities or percentages; computed values drifting below bounds (e.g. 1 - 1.2); clients written before minValue was added; unit confusion (fraction vs percent) producing out-of-range decimals.

Related errors


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