Skip to main content
Glama
QianJue-CN

Random.org MCP Server

by QianJue-CN

generateGaussians

Generate true random numbers from a Gaussian distribution for statistical simulations, modeling, and data analysis applications.

Instructions

Generate true random numbers from a Gaussian distribution

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYesNumber of Gaussian numbers to generate (1-10,000)
meanYesMean of the distribution
standardDeviationYesStandard deviation of the distribution
significantDigitsYesNumber of significant digits (2-20)

Implementation Reference

  • MCP tool handler function that delegates to RandomOrgClient and formats the response as MCP content.
    private async handleGenerateGaussians(args: any) {
      const result = await this.randomOrgClient.generateGaussians(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:149-179 (registration)
    Tool registration in the listTools response, including name, description, and input schema.
    {
      name: 'generateGaussians',
      description: 'Generate true random numbers from a Gaussian distribution',
      inputSchema: {
        type: 'object',
        properties: {
          n: {
            type: 'number',
            description: 'Number of Gaussian numbers to generate (1-10,000)',
            minimum: 1,
            maximum: 10000,
          },
          mean: {
            type: 'number',
            description: 'Mean of the distribution',
          },
          standardDeviation: {
            type: 'number',
            description: 'Standard deviation of the distribution',
            minimum: 0,
          },
          significantDigits: {
            type: 'number',
            description: 'Number of significant digits (2-20)',
            minimum: 2,
            maximum: 20,
          },
        },
        required: ['n', 'mean', 'standardDeviation', 'significantDigits'],
      },
    },
  • TypeScript interface defining the input parameters for generateGaussians, matching the JSON schema.
    export interface GaussianParams {
      n: number;
      mean: number;
      standardDeviation: number;
      significantDigits: number;
    }
  • Client wrapper method that validates params and makes the API request to Random.org.
    async generateGaussians(params: GaussianParams): Promise<GaussianResult> {
      this.validateGaussianParams(params);
      return this.makeRequest<GaussianResult>('generateGaussians', params);
    }
  • Validation helper for Gaussian parameters.
    private validateGaussianParams(params: GaussianParams): void {
      if (params.n < 1 || params.n > 10000) {
        throw new Error('n must be between 1 and 10,000');
      }
      if (params.significantDigits < 2 || params.significantDigits > 20) {
        throw new Error('significantDigits must be between 2 and 20');
      }
    }

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