validate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package validate provides small, generic request validators for MCP tools.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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

func RequireNonEmpty(field, value string) error

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.

Jump to

Keyboard shortcuts

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