{"record":{"id":"7a975431c6ee4c79","repo":"googleapis/mcp-toolbox","slug":"g-is-above-the-maximum-value","errorCode":null,"errorMessage":"%g is above the maximum value","messagePattern":"%g is above the maximum value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":935,"sourceCode":"\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\n// Manifest returns the manifest for the FloatParameter.\nfunc (p *FloatParameter) Manifest() ParameterManifest {\n\t// only list ParamAuthService names (without fields) in manifest","sourceCodeStart":917,"sourceCodeEnd":953,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L917-L953","documentation":"FloatParameter.Parse rejects a float because it exceeds the parameter's configured maxValue. The value parsed as a valid float but is above the upper bound tool authors set (e.g. probabilities must be <= 1). This is expected range validation by the toolbox.","triggerScenarios":"Invoking a tool with a float greater than maxValue configured via yaml 'maxValue:' or WithFloatMaxValue. Example: maxValue 1.0 and the request passes 1.5.","commonSituations":"Sending percentages (85) where fractions (0.85) are expected; LLMs overshooting bounds; computed values like ratios exceeding 1; clients built before maxValue was added to the tool config.","solutions":["Resend with a float <= the configured maxValue (check the tool's parameter manifest/description)","Convert units if needed (percent -> fraction) and clamp client-side, e.g. math.Min(maxValue, value)","If a higher ceiling is valid, raise maxValue in tools.yaml (or WithFloatMaxValue) and redeploy"],"exampleFix":"// before\nparams := map[string]any{\"probability\": 85} // percent, maxValue is 1.0\n// after\nparams := map[string]any{\"probability\": 0.85}","handlingStrategy":"validation","validationCode":"func validateMaxFloat(v, maxValue float64) error {\n    if v > maxValue {\n        return fmt.Errorf(\"%g exceeds maximum %g\", v, maxValue)\n    }\n    return nil\n}\n// usage: validateMaxFloat(probability, 1.0)","typeGuard":"func withinMaxFloat(v, maxValue float64) bool { return v <= maxValue }","tryCatchPattern":"out, err := tool.Parse(params)\nif err != nil && strings.Contains(err.Error(), \"is above the maximum value\") {\n    // clamp: params[key] = maxValue from manifest and retry once\n}","preventionTips":["Convert units before sending (percent 85 -> 0.85) when the bound is 1.0","Clamp floats client-side using maxValue from the manifest","State the maximum in the parameter description","Re-check clients when maxValue is tightened in tools.yaml"],"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"}