googleapis/mcp-toolbox · error
%s is not an allowed value
Error message
%s is not an allowed value
What it means
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.
Source
Thrown at internal/util/parameters/parameters.go:700
}
var _ Parameter = &StringParameter{}
// StringParameter is a parameter representing the "string" type.
type StringParameter struct {
CommonParameter `yaml:",inline"`
Default *string `yaml:"default"`
Escape *string `yaml:"escape"`
}
// Parse casts the value "v" as a "string".
func (p *StringParameter) Parse(v any) (any, error) {
newV, ok := v.(string)
if !ok {
return nil, &ParseTypeError{p.Name, p.Type, v}
}
if !p.IsAllowedValues(newV) {
return nil, fmt.Errorf("%s is not an allowed value", newV)
}
if p.IsExcludedValues(newV) {
return nil, fmt.Errorf("%s is an excluded value", newV)
}
if p.Escape != nil {
return applyEscape(*p.Escape, newV)
}
return newV, nil
}
func applyEscape(escape, v string) (any, error) {
switch escape {
case escapeBackticks:
escaped := strings.ReplaceAll(v, "`", "``")
return fmt.Sprintf("`%s`", escaped), nil
case escapeDoubleQuotes:
escaped := strings.ReplaceAll(v, `"`, `""`)
return fmt.Sprintf(`"%s"`, escaped), nilView on GitHub (pinned to 8cc6e09de2)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/util/parameters/parameters.go:700 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/86aae2fc382030cb.
Report an issue: GitHub.