{"record":{"id":"86aae2fc382030cb","repo":"googleapis/mcp-toolbox","slug":"s-is-not-an-allowed-value","errorCode":null,"errorMessage":"%s is not an allowed value","messagePattern":"(.+?) is not an allowed value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":700,"sourceCode":"}\n\nvar _ Parameter = &StringParameter{}\n\n// StringParameter is a parameter representing the \"string\" type.\ntype StringParameter struct {\n\tCommonParameter `yaml:\",inline\"`\n\tDefault         *string `yaml:\"default\"`\n\tEscape          *string `yaml:\"escape\"`\n}\n\n// Parse casts the value \"v\" as a \"string\".\nfunc (p *StringParameter) Parse(v any) (any, error) {\n\tnewV, ok := v.(string)\n\tif !ok {\n\t\treturn nil, &ParseTypeError{p.Name, p.Type, v}\n\t}\n\tif !p.IsAllowedValues(newV) {\n\t\treturn nil, fmt.Errorf(\"%s is not an allowed value\", newV)\n\t}\n\tif p.IsExcludedValues(newV) {\n\t\treturn nil, fmt.Errorf(\"%s is an excluded value\", newV)\n\t}\n\tif p.Escape != nil {\n\t\treturn applyEscape(*p.Escape, newV)\n\t}\n\treturn newV, nil\n}\n\nfunc applyEscape(escape, v string) (any, error) {\n\tswitch escape {\n\tcase escapeBackticks:\n\t\tescaped := strings.ReplaceAll(v, \"`\", \"``\")\n\t\treturn fmt.Sprintf(\"`%s`\", escaped), nil\n\tcase escapeDoubleQuotes:\n\t\tescaped := strings.ReplaceAll(v, `\"`, `\"\"`)\n\t\treturn fmt.Sprintf(`\"%s\"`, escaped), nil","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L682-L718","documentation":"StringParameter.Parse rejects the runtime value supplied for a string parameter because it is not in the parameter's 'allowedValues' whitelist. The guard fires at tool invocation time when the caller (or LLM) passes a value outside the configured enumeration; the offending value is named in the message.","triggerScenarios":"Thrown at internal/util/parameters/parameters.go:700 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass one of the values listed in the parameter's allowedValues in tools.yaml","Add the desired value to allowedValues if it should be permitted","Check for case or whitespace mismatches between the passed value and the whitelist"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}