googleapis/mcp-toolbox · error

%s is not an allowed escaping delimiter

Error message

%s is not an allowed escaping delimiter

What it means

This error is thrown by StringParameter's applyEscape helper when the parameter's configured 'escape' string does not match one of the four supported escaping delimiters (backticks, double quotes, single quotes, square brackets). It means the tools.yaml (or programmatic parameter config) specified an invalid escape mode, so the toolbox refuses to safely quote/escape the string value. It is a configuration error, not a data error — the value itself is fine, but the library cannot pick a quoting strategy.

Source

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

	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), nil
	case escapeSingleQuotes:
		escaped := strings.ReplaceAll(v, `'`, `''`)
		return fmt.Sprintf(`'%s'`, escaped), nil
	case escapeSquareBrackets:
		escaped := strings.ReplaceAll(v, "]", "]]")
		return fmt.Sprintf("[%s]", escaped), nil
	default:
		return nil, fmt.Errorf("%s is not an allowed escaping delimiter", escape)
	}
}

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

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

// Manifest returns the manifest for the StringParameter.
func (p *StringParameter) Manifest() ParameterManifest {
	// only list ParamAuthService names (without fields) in manifest
	authServiceNames := getAuthServiceNames(p.AuthServices)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Open your tools.yaml (or the WithStringEscape call) and set escape to exactly one of the allowed delimiters: backticks, doubleQuotes, singleQuotes, squareBrackets
  2. If you only need literal string substitution without quoting, remove the escape field entirely
  3. Check the version you are running against: older releases may only support a subset of delimiters; upgrade or downgrade to match your config
  4. Write a quick unit/config test that parses all tools.yaml files at CI time to catch invalid escape values before deployment

Example fix

# before
parameters:
  - name: my_id
    type: string
    escape: brackets
# after
parameters:
  - name: my_id
    type: string
    escape: squareBrackets
Defensive patterns

Strategy: validation

Validate before calling

var allowedEscapes = map[string]bool{"backticks": true, "doubleQuotes": true, "singleQuotes": true, "squareBrackets": true}
func validateEscape(escape string) error {
    if escape != "" && !allowedEscapes[escape] {
        return fmt.Errorf("escape %q must be one of backticks, doubleQuotes, singleQuotes, squareBrackets", escape)
    }
    return nil
}

Type guard

func isAllowedEscape(s string) bool {
    switch s {
    case "backticks", "doubleQuotes", "singleQuotes", "squareBrackets":
        return true
    }
    return false
}

Prevention

When it happens

Trigger: A StringParameter was declared with an 'escape' field (via yaml 'escape:' or WithStringEscape option) whose value is not exactly one of: backticks ('`'), doubleQuotes ('"'), singleQuotes ("'"), or squareBrackets ('[]'). E.g. escape: quotes, escape: bracket, escape: 'brackets', or a typo like escape: square_bracket.

Common situations: Hand-editing tools.yaml and guessing the escape mode name; migrating tool configs between toolbox versions where the accepted keyword set changed; AI/agent-generated configs inventing plausible-looking escape names; copying an escape value from another tool's config that used a different quoting convention.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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