Documentation
¶
Overview ¶
Package validate provides small, generic request validators for MCP tools.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmpty = errors.New("empty value")
ErrEmpty is returned (wrapped with the offending field name) when a required value is blank. As a toolkit ValidateFunc, the toolkit further wraps it with the tool name, preserving this sentinel for errors.Is.
var ErrZero = errors.New("zero value")
ErrZero is returned (wrapped with the offending field name) when a required value equals the zero value for its type, e.g. a numeric id of 0.
Functions ¶
func RequireNonEmpty ¶
RequireNonEmpty returns an error wrapping ErrEmpty, naming field, when value is blank after trimming whitespace.
func RequireNonZero ¶
func RequireNonZero[T comparable](field string, value T) error
RequireNonZero returns an error wrapping ErrZero, naming field, when value equals the zero value for its type. It complements RequireNonEmpty for non-string required inputs such as numeric ids.
Types ¶
This section is empty.