Skip to main content
Glama
VeriTeknik

Pluggedin Random Number Generator

generate_random_integer

Generate cryptographically secure random integers within a user-defined range. Specify minimum, maximum, and count to produce reliable random numbers for various applications.

Instructions

Generate cryptographically secure random integers within a specified range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of random integers to generate
maxNoMaximum value (inclusive)
minNoMinimum value (inclusive)

Implementation Reference

  • The handler function for 'generate_random_integer' tool. Validates input parameters (min, max, count), generates cryptographically secure random integers using crypto.randomInt, and returns JSON-formatted results.
    private async generateRandomInteger(args: any) {
      const min = args.min ?? 0;
      const max = args.max ?? 100;
      const count = args.count ?? 1;
    
      if (min > max) {
        throw new Error("Minimum value cannot be greater than maximum value");
      }
    
      if (count < 1 || count > 1000) {
        throw new Error("Count must be between 1 and 1000");
      }
    
      const results: number[] = [];
      for (let i = 0; i < count; i++) {
        // Use Node.js crypto.randomInt for cryptographically secure random integers
        results.push(randomInt(min, max + 1));
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              type: "random_integers",
              values: results,
              parameters: { min, max, count },
              timestamp: new Date().toISOString(),
            }, null, 2),
          },
        ],
      };
    }
  • Tool registration in ListToolsRequestSchema handler, including name, description, and detailed inputSchema for validation (min, max inclusive, count 1-1000).
    {
      name: "generate_random_integer",
      description: "Generate cryptographically secure random integers within a specified range",
      inputSchema: {
        type: "object",
        properties: {
          min: {
            type: "integer",
            description: "Minimum value (inclusive)",
            default: 0,
          },
          max: {
            type: "integer", 
            description: "Maximum value (inclusive)",
            default: 100,
          },
          count: {
            type: "integer",
            description: "Number of random integers to generate",
            default: 1,
            minimum: 1,
            maximum: 1000,
          },
        },
        required: [],
      },
    },
  • src/index.ts:249-250 (registration)
    Dispatch/registration in CallToolRequestSchema switch statement that routes calls to the generateRandomInteger handler.
    case "generate_random_integer":
      return await this.generateRandomInteger(args);
  • src/index.ts:46-241 (registration)
    Overall tool registration via ListToolsRequestSchema handler that lists all available tools including generate_random_integer.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "generate_random_integer",
            description: "Generate cryptographically secure random integers within a specified range",
            inputSchema: {
              type: "object",
              properties: {
                min: {
                  type: "integer",
                  description: "Minimum value (inclusive)",
                  default: 0,
                },
                max: {
                  type: "integer", 
                  description: "Maximum value (inclusive)",
                  default: 100,
                },
                count: {
                  type: "integer",
                  description: "Number of random integers to generate",
                  default: 1,
                  minimum: 1,
                  maximum: 1000,
                },
              },
              required: [],
            },
          },
          {
            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: [],
            },
          },
          {
            name: "generate_random_bytes",
            description: "Generate cryptographically secure random bytes",
            inputSchema: {
              type: "object",
              properties: {
                length: {
                  type: "integer",
                  description: "Number of random bytes to generate",
                  default: 32,
                  minimum: 1,
                  maximum: 1024,
                },
                encoding: {
                  type: "string",
                  description: "Output encoding format",
                  enum: ["hex", "base64", "binary"],
                  default: "hex",
                },
              },
              required: [],
            },
          },
          {
            name: "generate_uuid",
            description: "Generate a cryptographically secure UUID (v4)",
            inputSchema: {
              type: "object",
              properties: {
                count: {
                  type: "integer",
                  description: "Number of UUIDs to generate",
                  default: 1,
                  minimum: 1,
                  maximum: 100,
                },
                format: {
                  type: "string",
                  description: "UUID format",
                  enum: ["standard", "compact"],
                  default: "standard",
                },
              },
              required: [],
            },
          },
          {
            name: "generate_random_string",
            description: "Generate a cryptographically secure random string",
            inputSchema: {
              type: "object",
              properties: {
                length: {
                  type: "integer",
                  description: "Length of the random string",
                  default: 16,
                  minimum: 1,
                  maximum: 256,
                },
                charset: {
                  type: "string",
                  description: "Character set to use",
                  enum: ["alphanumeric", "alphabetic", "numeric", "hex", "base64", "ascii_printable"],
                  default: "alphanumeric",
                },
                count: {
                  type: "integer",
                  description: "Number of random strings to generate",
                  default: 1,
                  minimum: 1,
                  maximum: 100,
                },
              },
              required: [],
            },
          },
          {
            name: "generate_random_choice",
            description: "Randomly select items from a given list using cryptographically secure randomness",
            inputSchema: {
              type: "object",
              properties: {
                choices: {
                  type: "array",
                  description: "Array of items to choose from",
                  items: {
                    type: "string",
                  },
                  minItems: 1,
                },
                count: {
                  type: "integer",
                  description: "Number of items to select",
                  default: 1,
                  minimum: 1,
                },
                allow_duplicates: {
                  type: "boolean",
                  description: "Whether to allow duplicate selections",
                  default: true,
                },
              },
              required: ["choices"],
            },
          },
          {
            name: "generate_random_boolean",
            description: "Generate cryptographically secure random boolean values",
            inputSchema: {
              type: "object",
              properties: {
                count: {
                  type: "integer",
                  description: "Number of random booleans to generate",
                  default: 1,
                  minimum: 1,
                  maximum: 1000,
                },
                probability: {
                  type: "number",
                  description: "Probability of true (0.0 to 1.0)",
                  default: 0.5,
                  minimum: 0.0,
                  maximum: 1.0,
                },
              },
              required: [],
            },
          },
        ] as Tool[],
      };
    });
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. It adds valuable context by specifying 'cryptographically secure' (implying high-quality randomness suitable for security applications) and 'within a specified range' (defining the output scope). However, it doesn't disclose rate limits, error conditions, or performance characteristics that would be helpful for an agent.

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 that front-loads the core functionality ('Generate cryptographically secure random integers') and adds essential qualification ('within a specified range'). Every word earns its place with zero waste.

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 (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the core purpose and security aspect but lacks details on output format (e.g., array of integers), error handling, or sibling differentiation that would make it more complete for agent use.

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 already documents all three parameters (count, min, max) with their descriptions, defaults, and constraints. The description adds no additional parameter semantics beyond what's in the schema, maintaining the baseline score of 3.

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 verb ('generate') and resource ('cryptographically secure random integers') with specific scope ('within a specified range'). It distinguishes from sibling tools like generate_random_boolean, generate_random_bytes, etc., by specifying integer generation rather than other data types.

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 generate_random_float or generate_random_choice. It lacks explicit context about use cases, prerequisites, or exclusions, 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