{"record":{"id":"a4e5b6864cfffb6a","repo":"googleapis/mcp-toolbox","slug":"d-is-under-the-minimum-value","errorCode":null,"errorMessage":"%d is under the minimum value","messagePattern":"(.+?) is under the minimum value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":824,"sourceCode":"\tcase int32:\n\t\tout = int(newV)\n\tcase int64:\n\t\tout = int(newV)\n\tcase json.Number:\n\t\tnewI, err := newV.Int64()\n\t\tif err != nil {\n\t\t\treturn nil, &ParseTypeError{p.Name, p.Type, v}\n\t\t}\n\t\tout = int(newI)\n\t}\n\tif !p.IsAllowedValues(out) {\n\t\treturn nil, fmt.Errorf(\"%d is not an allowed value\", out)\n\t}\n\tif p.IsExcludedValues(out) {\n\t\treturn nil, fmt.Errorf(\"%d is an excluded value\", out)\n\t}\n\tif p.MinValue != nil && out < *p.MinValue {\n\t\treturn nil, fmt.Errorf(\"%d is under the minimum value\", out)\n\t}\n\tif p.MaxValue != nil && out > *p.MaxValue {\n\t\treturn nil, fmt.Errorf(\"%d is above the maximum value\", out)\n\t}\n\treturn out, nil\n}\n\nfunc (p *IntParameter) GetAuthServices() []ParamAuthService {\n\treturn p.AuthServices\n}\n\nfunc (p *IntParameter) GetDefault() any {\n\tif p.Default == nil {\n\t\treturn nil\n\t}\n\treturn *p.Default\n}\n","sourceCodeStart":806,"sourceCodeEnd":842,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L806-L842","documentation":"IntParameter.Parse rejects an integer because it is below the parameter's configured minValue. The value parsed as a valid int but fails the range check enforced by tool authors to keep queries safe (e.g. positive limits, non-negative offsets). This is expected input validation from the toolbox.","triggerScenarios":"Invoking a tool with an integer smaller than minValue configured via yaml 'minValue:' or WithIntMinValue. Example: minValue 1 and the request passes 0 or -5.","commonSituations":"LLMs choosing limit=0 or negative offsets; pagination code underflowing (page 0 -> offset -10); clients written before a minValue was added to the tool config; user-supplied numbers passed through unclamped.","solutions":["Resend the request with an integer >= the configured minValue (check the tool's parameter manifest/description)","Clamp values on the client side before calling, e.g. max(minValue, value)","If smaller values are legitimately useful, lower or remove minValue in tools.yaml (or WithIntMinValue) and redeploy"],"exampleFix":"// before\nparams := map[string]any{\"limit\": 0} // minValue is 1\n// after\nparams := map[string]any{\"limit\": 1}","handlingStrategy":"validation","validationCode":"func validateMinInt(v int, minValue int) error {\n    if v < minValue {\n        return fmt.Errorf(\"%d is below minimum %d\", v, minValue)\n    }\n    return nil\n}\n// usage: validateMinInt(limit, 1)","typeGuard":"func withinMinInt(v, minValue int) 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[\"limit\"] = minValue from manifest and retry once\n}","preventionTips":["Clamp numeric inputs client-side using minValue from the tool manifest","Guard pagination math against underflow (page 0)","Update the parameter description with the minimum so LLMs comply","Re-check clients after minValue is introduced to tool configs"],"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"}