Skip to main content
Glama

random_number

Generate a random number within a specified range for testing, sampling, or randomization needs in SEO workflows.

Instructions

Generate a random number within a specified range.

Args: min_value: Minimum value (default: 1) max_value: Maximum value (default: 100) Returns: Dictionary containing the random number and range info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
min_valueNo
max_valueNo

Implementation Reference

  • The main tool handler function that generates a random integer between min_value and max_value, returning a dictionary with the number, range string, and timestamp. Includes input validation.
    async def random_number(min_value: int = 1, max_value: int = 100) -> Dict[str, Any]: """Generate a random number within a specified range. Args: min_value: Minimum value (default: 1) max_value: Maximum value (default: 100) Returns: Dictionary containing the random number and range info """ if min_value > max_value: raise ValueError("min_value must be less than or equal to max_value") number = random.randint(min_value, max_value) return { "number": number, "range": f"{min_value}-{max_value}", "timestamp": time.time() }
  • List of regular example tools including the random_number handler, which gets imported and looped over for registration in mcp_ahrefs/server/app.py.
    example_tools = [ echo_tool, get_time, random_number, calculate_fibonacci ]
  • Registration loop that applies SAAGA decorators (exception_handler and tool_logger) to each tool in example_tools (including random_number) and registers them to the MCP server using mcp_server.tool(name=tool_name).
    for tool_func in example_tools: # Apply SAAGA decorator chain: exception_handler → tool_logger decorated_func = exception_handler(tool_logger(tool_func, config.__dict__)) # Extract metadata from the original function tool_name = tool_func.__name__ # Register the decorated function directly with MCP # This preserves the function signature for parameter introspection mcp_server.tool( name=tool_name )(decorated_func) unified_logger.info(f"Registered tool: {tool_name}")

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/SAGAAIDEV/mcp-ahrefs'

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