{"record":{"id":"331c05c9125eccc4","repo":"googleapis/mcp-toolbox","slug":"g-is-under-the-minimum-value","errorCode":null,"errorMessage":"%g is under the minimum value","messagePattern":"%g is under the minimum value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":932,"sourceCode":"\tcase float32:\n\t\tout = float64(newV)\n\tcase float64:\n\t\tout = newV\n\tcase json.Number:\n\t\tnewI, err := newV.Float64()\n\t\tif err != nil {\n\t\t\treturn nil, &ParseTypeError{p.Name, p.Type, v}\n\t\t}\n\t\tout = float64(newI)\n\t}\n\tif !p.IsAllowedValues(out) {\n\t\treturn nil, fmt.Errorf(\"%g is not an allowed value\", out)\n\t}\n\tif p.IsExcludedValues(out) {\n\t\treturn nil, fmt.Errorf(\"%g is an excluded value\", out)\n\t}\n\tif p.MinValue != nil && out < *p.MinValue {\n\t\treturn nil, fmt.Errorf(\"%g is under the minimum value\", out)\n\t}\n\tif p.MaxValue != nil && out > *p.MaxValue {\n\t\treturn nil, fmt.Errorf(\"%g is above the maximum value\", out)\n\t}\n\treturn out, nil\n}\n\nfunc (p *FloatParameter) GetAuthServices() []ParamAuthService {\n\treturn p.AuthServices\n}\n\nfunc (p *FloatParameter) GetDefault() any {\n\tif p.Default == nil {\n\t\treturn nil\n\t}\n\treturn *p.Default\n}\n","sourceCodeStart":914,"sourceCodeEnd":950,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L914-L950","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Resend with a float >= the configured minValue (see the tool's parameter manifest/description)","Clamp client-side before invoking, e.g. math.Max(minValue, value)","Fix upstream computation/unit conversion if values legitimately fall below the bound","If the bound is too strict, lower or remove minValue in tools.yaml (or WithFloatMinValue) and redeploy"],"exampleFix":"// before\nparams := map[string]any{\"probability\": -0.1} // minValue is 0\n// after\nparams := map[string]any{\"probability\": 0.0}","handlingStrategy":"validation","validationCode":"func validateMinFloat(v, minValue float64) error {\n    if v < minValue {\n        return fmt.Errorf(\"%g is below minimum %g\", v, minValue)\n    }\n    return nil\n}\n// usage: validateMinFloat(probability, 0.0)","typeGuard":"func withinMinFloat(v, minValue float64) bool { return v >= minValue }","tryCatchPattern":"out, err := tool.Parse(params)\nif err != nil && strings.Contains(err.Error(), \"is under the minimum value\") {\n    // clamp: params[key] = minValue from manifest and retry once\n}","preventionTips":["Clamp floats client-side using minValue from the tool manifest","Fix unit conversions (fraction vs percent) before sending","Guard computed values like 1-x against going below the bound","Note the minimum in the parameter description for LLM callers"],"tags":["go","validation","parameters","range-check"],"backgroundTag":"parameter-validation-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}