Skip to main content
Glama
zazencodes

Random Number MCP

by zazencodes

secure_token_hex

Generate cryptographically secure random hexadecimal tokens for secure authentication, API keys, or session IDs. Specify the number of bytes to customize token length.

Instructions

Generate a secure random hex token.

Args: nbytes: Number of random bytes to generate (default 32)

Returns: Hex string containing 2*nbytes characters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nbytesNo

Implementation Reference

  • MCP handler function for 'secure_token_hex' tool, registered with @app.tool() decorator, delegates implementation to tools.secure_token_hex
    @app.tool() def secure_token_hex(nbytes: int = 32) -> str: """Generate a secure random hex token. Args: nbytes: Number of random bytes to generate (default 32) Returns: Hex string containing 2*nbytes characters """ return tools.secure_token_hex(nbytes)
  • Core helper function implementing secure random hex token generation using Python's secrets module with input validation.
    def secure_token_hex(nbytes: int = 32) -> str: """Generate a secure random hex token. Args: nbytes: Number of random bytes to generate (default 32) Returns: Hex string containing 2*nbytes characters Raises: ValueError: If nbytes < 0 TypeError: If nbytes is not an integer """ validate_positive_int(nbytes, "nbytes") return secrets.token_hex(nbytes)

Other Tools

Related Tools

Latest Blog Posts

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