googleapis/mcp-toolbox · error

%t is not an allowed value

Error message

%t is not an allowed value

What it means

BooleanParameter.Parse rejects a boolean because it is not in the parameter's allowedValues list. Booleans parse strictly (only Go bool / JSON true/false are accepted); after a successful cast the value is checked against allowedValues, so a config that whitelists only true (or only false) will reject the other value. This is expected config-driven validation.

Source

Thrown at internal/util/parameters/parameters.go:1024

	}
	return p
}

var _ Parameter = &BooleanParameter{}

// BooleanParameter is a parameter representing the "boolean" type.
type BooleanParameter struct {
	CommonParameter `yaml:",inline"`
	Default         *bool `yaml:"default"`
}

func (p *BooleanParameter) Parse(v any) (any, error) {
	newV, ok := v.(bool)
	if !ok {
		return nil, &ParseTypeError{p.Name, p.Type, v}
	}
	if !p.IsAllowedValues(newV) {
		return nil, fmt.Errorf("%t is not an allowed value", newV)
	}
	if p.IsExcludedValues(newV) {
		return nil, fmt.Errorf("%t is an excluded value", newV)
	}
	return newV, nil
}

func (p *BooleanParameter) GetAuthServices() []ParamAuthService {
	return p.AuthServices
}

func (p *BooleanParameter) GetDefault() any {
	if p.Default == nil {
		return nil
	}
	return *p.Default
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Send the boolean value listed in the tool's parameter schema/manifest (e.g. true when only true is allowed)
  2. If the caller is an LLM, state the only permitted value in the parameter description
  3. If both values should be accepted, remove allowedValues from the parameter in tools.yaml (or drop WithBooleanAllowedValues) and redeploy

Example fix

// before
params := map[string]any{"dry_run": false} // allowedValues are [true]
// after
params := map[string]any{"dry_run": true}
Defensive patterns

Strategy: validation

Validate before calling

allowed := []bool{true}
func validateAllowedBool(v bool, allowed []bool) error {
    for _, a := range allowed {
        if v == a { return nil }
    }
    return fmt.Errorf("%t is not in allowedValues %v", v, allowed)
}

Type guard

func isAllowedBool(v bool, allowed []bool) bool {
    for _, a := range allowed { if v == a { return true } }
    return false
}

Try / catch

out, err := tool.Parse(params)
if err != nil && strings.Contains(err.Error(), "is not an allowed value") {
    // flip to the allowed boolean from the manifest and retry
}

Prevention

When it happens

Trigger: Calling a tool with a boolean argument that is not listed in the BooleanParameter's allowedValues (yaml 'allowedValues:' or WithBooleanAllowedValues). Example: allowedValues [true] but the request passes false.

Common situations: Tool authors restricting flags to a single direction (e.g. only allow enabling a feature) and clients/LLMs sending the opposite; configs copied between tools where one whitelisted booleans and the other did not; agents toggling flags during planning.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/9bd5306cc2ecc1e5. Report an issue: GitHub.