Skip to main content
Glama
zazencodes

Random Number MCP

by zazencodes

random_float

Generate custom floating-point numbers within a specified range using this tool. Set lower and upper bounds to create precise random values for simulations, testing, or data modeling.

Instructions

Generate a random float between low and high.

Args: low: Lower bound (default 0.0) high: Upper bound (default 1.0)

Returns: Random float between low and high

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
highNo
lowNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Registration of the 'random_float' MCP tool using the @app.tool() decorator, which also defines the input schema via type hints and docstring.
    @app.tool()
    def random_float(low: float = 0.0, high: float = 1.0) -> float:
        """Generate a random float between low and high.
    
        Args:
            low: Lower bound (default 0.0)
            high: Upper bound (default 1.0)
    
        Returns:
            Random float between low and high
        """
        return tools.random_float(low, high)
  • Core handler implementation for generating random float using random.uniform after validation.
    def random_float(low: float = 0.0, high: float = 1.0) -> float:
        """Generate a random float between low and high.
    
        Args:
            low: Lower bound (default 0.0)
            high: Upper bound (default 1.0)
    
        Returns:
            Random float between low and high
    
        Raises:
            ValueError: If low > high
            TypeError: If inputs are not numeric
        """
        if not isinstance(low, int | float) or not isinstance(high, int | float):
            raise TypeError("Both low and high must be numeric")
    
        validate_range(low, high)
        return random.uniform(low, high)
  • Helper function validate_range used to ensure low <= high in random_float.
    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})")
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool generates a random float and describes parameters, but lacks details on randomness quality (e.g., pseudo-random vs. cryptographic), potential side effects, error handling for invalid ranges, or performance characteristics. This leaves significant gaps for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is appropriately sized and well-structured, with a clear purpose statement followed by labeled sections for 'Args' and 'Returns'. Each sentence earns its place by providing essential information without redundancy, making it easy to scan and understand.

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, no annotations, and an output schema (implied by 'Returns'), the description is mostly complete. It covers purpose, parameters, and return values adequately. However, it lacks behavioral details like randomness source or error handling, which could enhance completeness for a tool with no annotations.

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

Parameters5/5

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

The description adds substantial meaning beyond the input schema, which has 0% description coverage. It explicitly defines 'low' as 'Lower bound (default 0.0)' and 'high' as 'Upper bound (default 1.0)', clarifying their roles and default values, which are not covered in the schema. This fully compensates for the schema's lack of descriptions.

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 ('a random float between low and high'), distinguishing it from sibling tools like random_int (integers) and secure_random_int (secure integers). It precisely defines 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 Guidelines3/5

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

The description implies usage for generating random floats within a specified range, but does not explicitly state when to use this tool versus alternatives like random_int for integers or secure_random_int for secure random numbers. No exclusions or specific contexts are provided, leaving usage guidance incomplete.

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

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