Skip to main content
Glama
QianJue-CN

Random.org MCP Server

by QianJue-CN

generateDecimalFractions

Generate true random decimal fractions between 0 and 1 for applications requiring statistically random data, with customizable quantity and precision.

Instructions

Generate true random decimal fractions between 0 and 1

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYesNumber of decimal fractions to generate (1-10,000)
decimalPlacesYesNumber of decimal places (1-20)
replacementNoAllow replacement (duplicates)

Implementation Reference

  • The primary MCP tool handler function that executes the generateDecimalFractions tool call by delegating to the RandomOrgClient and formatting the response as MCP-standard content.
    private async handleGenerateDecimalFractions(args: any) {
      const result = await this.randomOrgClient.generateDecimalFractions(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:122-148 (registration)
    Tool registration in the ListTools response, defining the tool's name, description, and input schema for validation.
    {
      name: 'generateDecimalFractions',
      description: 'Generate true random decimal fractions between 0 and 1',
      inputSchema: {
        type: 'object',
        properties: {
          n: {
            type: 'number',
            description: 'Number of decimal fractions to generate (1-10,000)',
            minimum: 1,
            maximum: 10000,
          },
          decimalPlaces: {
            type: 'number',
            description: 'Number of decimal places (1-20)',
            minimum: 1,
            maximum: 20,
          },
          replacement: {
            type: 'boolean',
            description: 'Allow replacement (duplicates)',
            default: true,
          },
        },
        required: ['n', 'decimalPlaces'],
      },
    },
  • JSON schema for input validation of the generateDecimalFractions tool parameters.
    inputSchema: {
      type: 'object',
      properties: {
        n: {
          type: 'number',
          description: 'Number of decimal fractions to generate (1-10,000)',
          minimum: 1,
          maximum: 10000,
        },
        decimalPlaces: {
          type: 'number',
          description: 'Number of decimal places (1-20)',
          minimum: 1,
          maximum: 20,
        },
        replacement: {
          type: 'boolean',
          description: 'Allow replacement (duplicates)',
          default: true,
        },
      },
      required: ['n', 'decimalPlaces'],
    },
  • Helper method in RandomOrgClient that handles parameter validation and makes the actual API request to random.org.
    async generateDecimalFractions(params: DecimalParams): Promise<DecimalResult> {
      this.validateDecimalParams(params);
      return this.makeRequest<DecimalResult>('generateDecimalFractions', params);
    }
  • Parameter validation helper specifically for decimal fractions inputs.
    private validateDecimalParams(params: DecimalParams): void {
      if (params.n < 1 || params.n > 10000) {
        throw new Error('n must be between 1 and 10,000');
      }
      if (params.decimalPlaces < 1 || params.decimalPlaces > 20) {
        throw new Error('decimalPlaces must be between 1 and 20');
      }
    }
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 'true random' (implying quality) and the range (0-1), but lacks critical behavioral details: whether this is a read-only operation, if it has rate limits, how randomness is sourced, or what the output format looks like. For a tool with no annotations, this is a significant gap.

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: 'Generate true random decimal fractions between 0 and 1'. It is front-loaded with the core purpose, has zero wasted words, and appropriately sized for a simple tool. Every part of the sentence adds value.

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 basic purpose but lacks behavioral context, usage guidance, and output details. The schema handles parameters well, but without annotations or output schema, the description should do more to compensate for these gaps.

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 parameters (n, decimalPlaces, replacement) with descriptions and constraints. The description adds no parameter-specific information beyond what the schema provides, such as explaining the interaction between parameters or default behaviors. Baseline 3 is appropriate 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 tool's purpose: 'Generate true random decimal fractions between 0 and 1'. It specifies the verb ('generate'), resource ('true random decimal fractions'), and scope ('between 0 and 1'). However, it doesn't explicitly differentiate from sibling tools like 'generateGaussians' or 'generateIntegers', which likely generate different types of random numbers.

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. It doesn't mention sibling tools like 'generateGaussians' (for normal distributions) or 'generateIntegers' (for whole numbers), nor does it specify use cases or prerequisites. The agent must infer usage from the description 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

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