{"record":{"id":"4ba6a226c7dfab5d","repo":"googleapis/mcp-toolbox","slug":"d-is-an-excluded-value","errorCode":null,"errorMessage":"%d is an excluded value","messagePattern":"(.+?) is an excluded value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":821,"sourceCode":"\t\treturn nil, &ParseTypeError{p.Name, p.Type, v}\n\tcase int:\n\t\tout = int(newV)\n\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}","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L803-L839","documentation":"IntParameter.Parse rejects an integer because it appears in the parameter's excludedValues blacklist. Unlike allowedValues (a whitelist), excludedValues lets tool authors forbid specific known-bad numbers while allowing everything else. The value parsed fine as an int; it is simply on the forbidden list.","triggerScenarios":"Invoking a tool with an integer that matches an entry in the IntParameter's excludedValues (yaml 'excludedValues:' or WithIntExcludedValues). Example: excludedValues [0] and the request passes 0.","commonSituations":"Blocking sentinel values like 0 or -1 that mean 'unset' upstream; excluding ids known to be invalid in a database; clients/default templates still sending a value that was later blacklisted in the tool config.","solutions":["Pick a different integer that is not in the parameter's excludedValues list (check the tool schema/manifest)","If the value is actually legitimate, remove it from excludedValues in tools.yaml (or WithIntExcludedValues) and restart/redeploy the toolbox","If 0 or -1 was intended as 'use default', omit the parameter so the configured default is applied instead"],"exampleFix":"// before\nparams := map[string]any{\"page\": 0} // excludedValues include 0\n// after\nparams := map[string]any{\"page\": 1}","handlingStrategy":"validation","validationCode":"excluded := []int{0, -1}\nfunc validateNotExcluded(v int, excluded []int) error {\n    for _, e := range excluded {\n        if v == e { return fmt.Errorf(\"%d is excluded\", v) }\n    }\n    return nil\n}","typeGuard":"func isExcludedInt(v int, excluded []int) bool {\n    for _, e := range excluded { if v == e { return true } }\n    return false\n}","tryCatchPattern":"out, err := tool.Parse(params)\nif err != nil && strings.Contains(err.Error(), \"is an excluded value\") {\n    // substitute a safe value or omit the param to use the default\n}","preventionTips":["Check excludedValues in the tool manifest before sending sentinel values like 0 or -1","Prefer omitting the parameter (using defaults) instead of sending blacklisted sentinels","Review excludedValues whenever updating tool configs","Document forbidden values in the parameter description"],"tags":["go","validation","parameters","integer"],"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"}