Skip to main content
Glama
QianJue-CN

Random.org MCP Server

by QianJue-CN

generateIntegers

Generate true random integers within a specified range using Random.org's quantum randomness for applications requiring verifiable randomness.

Instructions

Generate true random integers within a specified range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYesNumber of integers to generate (1-10,000)
minYesMinimum value (inclusive)
maxYesMaximum value (inclusive)
replacementNoAllow replacement (duplicates)
baseNoNumber base (2, 8, 10, or 16)

Implementation Reference

  • MCP tool handler that delegates to RandomOrgClient.generateIntegers and formats the result as MCP content response.
    private async handleGenerateIntegers(args: any) {
      const result = await this.randomOrgClient.generateIntegers(args);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              data: result.random.data,
              completionTime: result.random.completionTime,
              bitsUsed: result.bitsUsed,
              bitsLeft: result.bitsLeft,
              requestsLeft: result.requestsLeft,
              advisoryDelay: result.advisoryDelay,
            }, null, 2),
          },
        ],
      };
    }
  • src/server.ts:38-76 (registration)
    Registration of the generateIntegers tool in the ListTools handler, including description and input JSON schema.
    {
      name: 'generateIntegers',
      description: 'Generate true random integers within a specified range',
      inputSchema: {
        type: 'object',
        properties: {
          n: {
            type: 'number',
            description: 'Number of integers to generate (1-10,000)',
            minimum: 1,
            maximum: 10000,
          },
          min: {
            type: 'number',
            description: 'Minimum value (inclusive)',
            minimum: -1000000000,
            maximum: 1000000000,
          },
          max: {
            type: 'number',
            description: 'Maximum value (inclusive)',
            minimum: -1000000000,
            maximum: 1000000000,
          },
          replacement: {
            type: 'boolean',
            description: 'Allow replacement (duplicates)',
            default: true,
          },
          base: {
            type: 'number',
            description: 'Number base (2, 8, 10, or 16)',
            enum: [2, 8, 10, 16],
            default: 10,
          },
        },
        required: ['n', 'min', 'max'],
      },
    },
  • TypeScript interface for input parameters (IntegerParams) used in generateIntegers.
    export interface IntegerParams {
      n: number;
      min: number;
      max: number;
      replacement?: boolean;
      base?: number;
    }
  • Core helper method that validates parameters and makes the JSON-RPC request to random.org API for generateIntegers.
    async generateIntegers(params: IntegerParams): Promise<IntegerResult> {
      this.validateIntegerParams(params);
      return this.makeRequest<IntegerResult>('generateIntegers', params);
    }
  • Input validation helper for generateIntegers parameters.
    private validateIntegerParams(params: IntegerParams): void {
      if (params.n < 1 || params.n > 10000) {
        throw new Error('n must be between 1 and 10,000');
      }
      if (params.min < -1000000000 || params.min > 1000000000) {
        throw new Error('min must be between -1,000,000,000 and 1,000,000,000');
      }
      if (params.max < -1000000000 || params.max > 1000000000) {
        throw new Error('max must be between -1,000,000,000 and 1,000,000,000');
      }
      if (params.min >= params.max) {
        throw new Error('min must be less than max');
      }
      if (params.base && ![2, 8, 10, 16].includes(params.base)) {
        throw new Error('base must be 2, 8, 10, or 16');
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'generate true random integers' implies a read-only operation, it doesn't address important behavioral aspects: whether there are rate limits, authentication requirements, what 'true random' means (source of randomness), whether results are reproducible, or what format the output takes. The description is too minimal for a tool with 5 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 that states the core functionality without unnecessary words. It's appropriately sized for a straightforward generation tool and front-loads the essential information. Every word earns its place in conveying the tool's purpose.

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

Completeness2/5

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

Given the tool's complexity (5 parameters, no output schema, no annotations), the description is insufficiently complete. It doesn't explain the output format, doesn't address the 'true random' claim's implications, and provides no behavioral context. For a generation tool with multiple configuration options and no structured output documentation, the description should do more to help the agent understand what to expect.

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?

The description mentions 'within a specified range' which hints at the min/max parameters, but doesn't add meaningful semantics beyond what the 100% schema coverage already provides. The schema descriptions thoroughly document each parameter's purpose, constraints, defaults, and allowed values. The description provides no additional parameter context, earning the baseline score for high schema coverage.

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 as 'Generate true random integers within a specified range' - a specific verb ('generate') and resource ('true random integers') with scope ('within a specified range'). However, it doesn't differentiate from sibling tools like 'generateIntegerSequences' which might generate sequential rather than random integers, or explain what makes these integers 'true random' versus pseudo-random.

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. There's no mention of alternatives like 'generateIntegerSequences' for sequential generation or 'generateDecimalFractions' for non-integer values. The agent must infer usage from tool names alone, which is insufficient for optimal selection.

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/QianJue-CN/TRUERandomMCP'

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