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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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}")
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return format ('Dictionary containing the random number and range info'), which adds value beyond the input schema. However, it doesn't cover aspects like whether the tool is deterministic, has rate limits, or requires specific permissions, leaving gaps in behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the core purpose. The structured 'Args' and 'Returns' sections are efficient, but the repetition of default values in both the description and schema could be slightly streamlined. Overall, it's concise with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity, 2 parameters, no annotations, and the presence of an output schema (which handles return values), the description is mostly complete. It covers the purpose, parameters, and return format adequately. However, it could improve by addressing behavioral traits like randomness characteristics or error handling for invalid ranges.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains that 'min_value' is the 'Minimum value' and 'max_value' is the 'Maximum value', including default values, which compensates for the schema's lack of descriptions. Since there are only 2 parameters, this is sufficient for a high score, though it doesn't detail constraints like integer-only inputs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Generate') and resource ('random number'), and distinguishes it from siblings by focusing on random number generation rather than calculation, time retrieval, or data processing. It precisely communicates what the tool does without being vague or tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'calculate_fibonacci' or 'simulate_heavy_computation'. It lacks explicit context, exclusions, or comparisons with sibling tools, leaving the agent without usage direction beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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