googleapis/mcp-toolbox · error

resource name SHOULD be between 1 and 128 characters in leng

Error message

resource name SHOULD be between 1 and 128 characters in length (inclusive)

What it means

Error "resource name SHOULD be between 1 and 128 characters in length (inclusive)" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/server/config.go:614

	// Use the central registry to decode the prompt based on its type.
	promptCfg, err := prompts.DecodeConfig(ctx, resourceType, name, dec)
	if err != nil {
		return nil, err
	}
	return promptCfg, nil
}

// Tools naming validation is added in the MCP v2025-11-25, but we'll be
// implementing it across Toolbox
// Tool names SHOULD be between 1 and 128 characters in length (inclusive).
// Tool names SHOULD be considered case-sensitive.
// The following SHOULD be the only allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits (0-9), underscore (_), hyphen (-), and dot (.)
// Tool names SHOULD NOT contain spaces, commas, or other special characters.
// Tool names SHOULD be unique within a server.
func NameValidation(name string) error {
	strLen := len(name)
	if strLen < 1 || strLen > 128 {
		return fmt.Errorf("resource name SHOULD be between 1 and 128 characters in length (inclusive)")
	}
	validChars := regexp.MustCompile("^[a-zA-Z0-9_.-]+$")
	isValid := validChars.MatchString(name)
	if !isValid {
		return fmt.Errorf("invalid character for resource name; only uppercase and lowercase ASCII letters (A-Z, a-z), digits (0-9), underscore (_), hyphen (-), and dot (.) is allowed")
	}
	return nil
}

func formatDocLocation(docIndex int, keyToken *token.Token, body ast.Node) string {
	line, column := 0, 0
	if keyToken != nil {
		line = keyToken.Position.Line
		column = keyToken.Position.Column
	} else if body != nil && body.GetToken() != nil {
		line = body.GetToken().Position.Line
		column = body.GetToken().Position.Column
	}

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/server/config.go:614 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/9888a3ab1651ba71. Report an issue: GitHub.