Skip to main content
Glama
zazencodes

Random Number MCP

by zazencodes

random_shuffle

Shuffle any list of items into a new random order using this tool, ideal for generating randomized sequences efficiently. Part of the Random Number MCP server for random generation tasks.

Instructions

Return a new list with items in random order.

Args: items: List of items to shuffle

Returns: New list with items in random order

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
itemsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP handler function for the 'random_shuffle' tool. Decorated with @app.tool() for registration and delegates execution to the core logic in tools.py.
    @app.tool()
    def random_shuffle(items: list[Any]) -> list[Any]:
        """Return a new list with items in random order.
    
        Args:
            items: List of items to shuffle
    
        Returns:
            New list with items in random order
        """
        return tools.random_shuffle(items)
  • Core helper function implementing the shuffling logic using random.sample(population, len(population)) to return a new shuffled list without modifying the original.
    def random_shuffle(items: list[Any]) -> list[Any]:
        """Return a new list with items in random order.
    
        Args:
            items: List of items to shuffle
    
        Returns:
            New list with items in random order
    
        Raises:
            ValueError: If items list is empty
        """
        validate_list_not_empty(items, "items")
    
        # Use random.sample to return a new list instead of shuffling in place
        return random.sample(items, len(items))
  • Registration of the 'random_shuffle' tool via @app.tool() decorator on the FastMCP server instance.
    @app.tool()
    def random_shuffle(items: list[Any]) -> list[Any]:
        """Return a new list with items in random order.
    
        Args:
            items: List of items to shuffle
    
        Returns:
            New list with items in random order
        """
        return tools.random_shuffle(items)
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. It mentions the tool returns a 'new list' (implying non-destructive) and 'random order,' but lacks details on randomness quality (e.g., cryptographic vs. pseudo-random), performance, or side effects. For a tool with no annotation coverage, this is insufficient behavioral disclosure.

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 well-structured and concise. It front-loads the core purpose in the first sentence, followed by clear 'Args' and 'Returns' sections. Every sentence earns its place, with no redundant information. The formatting enhances readability without unnecessary verbosity.

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 (one parameter, simple operation) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the purpose, parameter semantics, and return behavior. However, it lacks usage guidelines and deeper behavioral context, which are minor gaps in this context.

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 context beyond the input schema. The schema has 0% description coverage and only indicates 'items' is an array. The description clarifies that 'items' is a 'List of items to shuffle,' providing semantic understanding. With 1 parameter and low schema coverage, this compensation is effective, though not exhaustive (e.g., no details on item types).

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

Purpose4/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: 'Return a new list with items in random order.' It specifies the verb ('return') and resource ('new list'), and distinguishes it from siblings like random_choices or random_sample by focusing on shuffling rather than selecting. However, it doesn't explicitly contrast with all siblings, keeping it at 4 instead of 5.

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. With siblings like random_choices (selecting items) and random_sample (sampling without replacement), there's no indication of when shuffling is preferred over other random operations. The description only states what it does, not when to use it.

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