Skip to main content
Glama
VeriTeknik

Pluggedin Random Number Generator

generate_random_float

Generate cryptographically secure random floating-point numbers within a specified range, count, and precision for reliable data simulations or applications.

Instructions

Generate cryptographically secure random floating-point numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of random floats to generate
maxNoMaximum value (exclusive)
minNoMinimum value (inclusive)
precisionNoNumber of decimal places to round to

Implementation Reference

  • Core implementation of the generate_random_float tool handler. Uses crypto.randomBytes for secure randomness, scales to [min, max), applies precision rounding, generates multiple values if specified, and returns structured JSON response.
    private async generateRandomFloat(args: any) {
      const min = args.min ?? 0.0;
      const max = args.max ?? 1.0;
      const count = args.count ?? 1;
      const precision = args.precision ?? 6;
    
      if (min >= max) {
        throw new Error("Minimum value must be less than maximum value");
      }
    
      if (count < 1 || count > 1000) {
        throw new Error("Count must be between 1 and 1000");
      }
    
      if (precision < 1 || precision > 15) {
        throw new Error("Precision must be between 1 and 15");
      }
    
      const results: number[] = [];
      for (let i = 0; i < count; i++) {
        // Generate cryptographically secure random float
        const randomBuffer = randomBytes(4);
        const randomValue = randomBuffer.readUInt32BE(0) / 0xFFFFFFFF;
        const scaledValue = min + (randomValue * (max - min));
        results.push(parseFloat(scaledValue.toFixed(precision)));
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              type: "random_floats",
              values: results,
              parameters: { min, max, count, precision },
              timestamp: new Date().toISOString(),
            }, null, 2),
          },
        ],
      };
    }
  • Input schema for generate_random_float tool defining parameters: min (number, default 0.0), max (number, default 1.0 exclusive), count (1-1000, default 1), precision (1-15 decimals, default 6).
    inputSchema: {
      type: "object",
      properties: {
        min: {
          type: "number",
          description: "Minimum value (inclusive)",
          default: 0.0,
        },
        max: {
          type: "number",
          description: "Maximum value (exclusive)",
          default: 1.0,
        },
        count: {
          type: "integer",
          description: "Number of random floats to generate",
          default: 1,
          minimum: 1,
          maximum: 1000,
        },
        precision: {
          type: "integer",
          description: "Number of decimal places to round to",
          default: 6,
          minimum: 1,
          maximum: 15,
        },
      },
      required: [],
    },
  • src/index.ts:76-109 (registration)
    Tool registration in ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: "generate_random_float",
      description: "Generate cryptographically secure random floating-point numbers",
      inputSchema: {
        type: "object",
        properties: {
          min: {
            type: "number",
            description: "Minimum value (inclusive)",
            default: 0.0,
          },
          max: {
            type: "number",
            description: "Maximum value (exclusive)",
            default: 1.0,
          },
          count: {
            type: "integer",
            description: "Number of random floats to generate",
            default: 1,
            minimum: 1,
            maximum: 1000,
          },
          precision: {
            type: "integer",
            description: "Number of decimal places to round to",
            default: 6,
            minimum: 1,
            maximum: 15,
          },
        },
        required: [],
      },
    },
  • src/index.ts:251-252 (registration)
    Dispatch registration in CallToolRequestSchema switch statement, routing calls to generate_random_float to the handler method.
    case "generate_random_float":
      return await this.generateRandomFloat(args);
Behavior2/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 adds value by specifying 'cryptographically secure' (implying high-quality randomness suitable for security applications) and 'floating-point numbers' (indicating decimal outputs). However, it lacks details on performance, error handling, or output format (e.g., array vs. single value), which are critical for a tool with parameters.

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 a single, efficient sentence with zero waste—it directly states the tool's core function without redundancy. It's appropriately sized for a straightforward tool and front-loaded with essential information.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and security aspect but omits guidance on usage versus siblings and behavioral details like output structure. Without annotations or output schema, more context on what to expect (e.g., returns a list) would improve completeness.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all four parameters (count, min, max, precision) with descriptions, defaults, and constraints. The description adds no parameter-specific information beyond implying floating-point outputs, aligning with the baseline score of 3 when the schema does the heavy lifting.

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 verb ('generate') and resource ('cryptographically secure random floating-point numbers'), making the purpose immediately understandable. It distinguishes from siblings by specifying 'floating-point numbers' rather than booleans, bytes, integers, etc., though it doesn't explicitly contrast with them.

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 its siblings (e.g., generate_random_integer for whole numbers, generate_random_choice for selections). There's no mention of use cases, prerequisites, or alternatives, leaving the agent to infer usage from the name alone.

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/VeriTeknik/pluggedin-random-number-generator-mcp'

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