{"record":{"id":"1ab4b3909695bd82","repo":"googleapis/mcp-toolbox","slug":"g-is-an-excluded-value","errorCode":null,"errorMessage":"%g is an excluded value","messagePattern":"%g is an excluded value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":929,"sourceCode":"\tswitch newV := v.(type) {\n\tdefault:\n\t\treturn nil, &ParseTypeError{p.Name, p.Type, v}\n\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}","sourceCodeStart":911,"sourceCodeEnd":947,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L911-L947","documentation":"FloatParameter.Parse rejects a float because it appears in the parameter's excludedValues blacklist. This lets tool authors forbid specific known-bad decimal values (e.g. 0.0 as an invalid factor) while allowing all others. The value is a valid float; it is simply forbidden by config.","triggerScenarios":"Invoking a tool with a float that matches an entry in the FloatParameter's excludedValues (yaml 'excludedValues:' or WithFloatExcludedValues). Example: excludedValues [0.0] and the request passes 0.0.","commonSituations":"Blocking zero/negative multipliers that would break SQL; excluding NaN-like sentinels; defaults or templates still emitting a value that was later blacklisted.","solutions":["Resend with a float not in the excludedValues list (check the tool's parameter schema)","If 0.0 meant 'use default', omit the parameter so the configured default applies","If the value is legitimate, remove it from excludedValues in tools.yaml (or WithFloatExcludedValues) and redeploy"],"exampleFix":"// before\nparams := map[string]any{\"factor\": 0.0} // excludedValues include 0.0\n// after\nparams := map[string]any{\"factor\": 1.0}","handlingStrategy":"validation","validationCode":"excluded := []float64{0.0}\nfunc validateNotExcludedFloat(v float64, excluded []float64) error {\n    for _, e := range excluded {\n        if v == e { return fmt.Errorf(\"%g is excluded\", v) }\n    }\n    return nil\n}","typeGuard":"func isExcludedFloat(v float64, excluded []float64) 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":["Avoid sending blacklisted sentinels (0.0, negatives) — omit the parameter instead","Check excludedValues in the manifest before computed values are sent","Document forbidden floats in the parameter description","Review excludedValues on every tool config change"],"tags":["go","validation","parameters","float"],"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"}