Skip to main content
Glama
QianJue-CN

Random.org MCP Server

by QianJue-CN

generateStrings

Generate cryptographically secure random strings using specified character sets and length parameters for applications requiring true randomness.

Instructions

Generate true random strings

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYesNumber of strings to generate (1-10,000)
lengthYesLength of each string (1-20)
charactersYesCharacters to use for generation
replacementNoAllow replacement within each string

Implementation Reference

  • The primary MCP tool handler for 'generateStrings'. It calls the RandomOrgClient to generate strings and formats the response as MCP content.
    private async handleGenerateStrings(args: any) {
      const result = await this.randomOrgClient.generateStrings(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:180-210 (registration)
    Registration of the 'generateStrings' tool in the MCP server's listTools handler, including name, description, and input schema.
    {
      name: 'generateStrings',
      description: 'Generate true random strings',
      inputSchema: {
        type: 'object',
        properties: {
          n: {
            type: 'number',
            description: 'Number of strings to generate (1-10,000)',
            minimum: 1,
            maximum: 10000,
          },
          length: {
            type: 'number',
            description: 'Length of each string (1-20)',
            minimum: 1,
            maximum: 20,
          },
          characters: {
            type: 'string',
            description: 'Characters to use for generation',
          },
          replacement: {
            type: 'boolean',
            description: 'Allow replacement within each string',
            default: true,
          },
        },
        required: ['n', 'length', 'characters'],
      },
    },
  • RandomOrgClient method implementing the generateStrings API call via JSON-RPC, including validation.
    async generateStrings(params: StringParams): Promise<StringResult> {
      this.validateStringParams(params);
      return this.makeRequest<StringResult>('generateStrings', params);
    }
  • Helper function validating input parameters for generateStrings against random.org constraints.
    private validateStringParams(params: StringParams): void {
      if (params.n < 1 || params.n > 10000) {
        throw new Error('n must be between 1 and 10,000');
      }
      if (params.length < 1 || params.length > 20) {
        throw new Error('length must be between 1 and 20');
      }
      if (!params.characters || params.characters.length === 0) {
        throw new Error('characters must be a non-empty string');
      }
    }
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 mentions 'true random strings' but doesn't explain what 'true random' entails (e.g., cryptographically secure, source of randomness), potential rate limits, error conditions, or output format. This is inadequate for a tool with parameters and no output schema.

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 wasted words. It's front-loaded with the core purpose, making it easy to parse quickly. Every word earns its place by directly conveying the tool's function.

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 has four parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like randomness quality, output format (e.g., array of strings), or error handling, leaving significant gaps for the agent to operate effectively.

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 input schema has 100% description coverage, clearly documenting all four parameters (n, length, characters, replacement) with constraints and defaults. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 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 'Generate true random strings' clearly states the verb ('Generate') and resource ('true random strings'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like generateUUIDs or generateBlobs, which also generate random data but of different 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 generateUUIDs for UUIDs or generateBlobs for binary data. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool 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

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