Skip to main content
Glama

Random Number MCP

by zazencodes
MIT License
42
  • Apple
utils.py1.18 kB
"""Utility functions for the random number MCP server.""" from typing import Any def validate_range(low: int | float, high: int | float) -> None: """Validate that low <= high for range-based functions.""" if low > high: raise ValueError(f"Low value ({low}) must be <= high value ({high})") def validate_positive_int(value: int, name: str) -> None: """Validate that a value is a positive integer.""" if not isinstance(value, int): raise TypeError(f"{name} must be an integer, got {type(value).__name__}") if value < 0: raise ValueError(f"{name} must be non-negative, got {value}") def validate_list_not_empty(items: list[Any], name: str) -> None: """Validate that a list is not empty.""" if not items: raise ValueError(f"{name} cannot be empty") def validate_weights_match_population( population: list[Any], weights: list[int | float] ) -> None: """Validate that weights list matches population length.""" if len(weights) != len(population): raise ValueError( f"Weights list length ({len(weights)}) must match " f"population length ({len(population)})" )

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zazencodes/random-number-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server