validators

package
v0.4.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package validators provides validation functions for MCP Registry Server entities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidServerName

func IsValidServerName(name string) bool

IsValidServerName checks if a server name is valid according to the MCP Registry specification. Returns true if valid, false otherwise. This is a convenience wrapper around ValidateServerName for boolean checks.

func ValidateServerName

func ValidateServerName(name string) (string, error)

ValidateServerName validates a server name according to the MCP Registry specification. The name must be in reverse-DNS format: namespace/name Returns the validated name (trimmed) and an error if validation fails.

Format requirements: - Must contain exactly one '/' separator - Namespace (before /): [a-zA-Z0-9][a-zA-Z0-9.-]*[a-zA-Z0-9] - Name (after /): [a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9] - Total length: 3-200 characters

Examples of valid names:

  • com.toolhive.k8s.default/weather-service (K8s auto-discovered)
  • com.example/server (manually published)
  • org.stacklok.toolhive/my-server (manually published)
  • com.example/test_server (manually published - underscores allowed in name part)

Examples of invalid names:

  • my-server (missing slash)
  • com.example//server (multiple slashes)
  • .example/server (namespace starts with dot)
  • com.example/server- (name ends with dash)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL