{"record":{"id":"c58f1aab1e97a057","repo":"googleapis/mcp-toolbox","slug":"d-is-above-the-maximum-value","errorCode":null,"errorMessage":"%d is above the maximum value","messagePattern":"(.+?) is above the maximum value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":827,"sourceCode":"\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\n// Manifest returns the manifest for the IntParameter.\nfunc (p *IntParameter) Manifest() ParameterManifest {\n\t// only list ParamAuthService names (without fields) in manifest","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L809-L845","documentation":"IntParameter.Parse rejects an integer because it exceeds the parameter's configured maxValue. The value parsed as a valid int but is larger than the ceiling tool authors set, typically to protect databases from oversized LIMITs or huge offsets. This is expected input validation, not a library fault.","triggerScenarios":"Invoking a tool with an integer greater than maxValue configured via yaml 'maxValue:' or WithIntMaxValue. Example: maxValue 100 and the request passes 1000.","commonSituations":"LLMs picking generous limits like 10000; clients assuming no cap after the tool config added maxValue; bulk-export scripts requesting more rows per call than allowed.","solutions":["Resend with an integer <= the configured maxValue (see the tool's parameter manifest/description)","Clamp the value client-side, e.g. min(maxValue, value)","If a higher ceiling is valid, raise maxValue in tools.yaml (or WithIntMaxValue) and redeploy the toolbox"],"exampleFix":"// before\nparams := map[string]any{\"limit\": 1000} // maxValue is 100\n// after\nparams := map[string]any{\"limit\": 100}","handlingStrategy":"validation","validationCode":"func validateMaxInt(v int, maxValue int) error {\n    if v > maxValue {\n        return fmt.Errorf(\"%d exceeds maximum %d\", v, maxValue)\n    }\n    return nil\n}\n// usage: validateMaxInt(limit, 100)","typeGuard":"func withinMaxInt(v, maxValue int) 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[\"limit\"] = maxValue from manifest and retry once\n}","preventionTips":["Clamp limits/sizes client-side using maxValue from the tool manifest","Never assume an unbounded LIMIT; read the parameter manifest","State the maximum in the parameter description for LLM callers","Re-verify bulk scripts after 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"}