Skip to main content
Glama
QianJue-CN

Random.org MCP Server

by QianJue-CN

generateBlobs

Generate true random binary data for cryptographic applications, simulations, or testing by specifying quantity and size parameters with output in base64 or hex format.

Instructions

Generate true random binary data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nYesNumber of blobs to generate (1-100)
sizeYesSize of each blob in bytes (1-1,048,576)
formatNoOutput formatbase64

Implementation Reference

  • src/server.ts:227-254 (registration)
    Tool registration in listTools handler, defining name, description, and input schema for generateBlobs.
    { name: 'generateBlobs', description: 'Generate true random binary data', inputSchema: { type: 'object', properties: { n: { type: 'number', description: 'Number of blobs to generate (1-100)', minimum: 1, maximum: 100, }, size: { type: 'number', description: 'Size of each blob in bytes (1-1,048,576)', minimum: 1, maximum: 1048576, }, format: { type: 'string', description: 'Output format', enum: ['base64', 'hex'], default: 'base64', }, }, required: ['n', 'size'], }, },
  • MCP server handler for the generateBlobs tool. Invokes RandomOrgClient.generateBlobs and formats the response as MCP content block.
    private async handleGenerateBlobs(args: any) { const result = await this.randomOrgClient.generateBlobs(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), }, ], }; }
  • TypeScript interface defining the input parameters (BlobParams) for the generateBlobs API call.
    export interface BlobParams { n: number; size: number; format?: 'base64' | 'hex'; }
  • RandomOrgClient method that performs input validation and makes the JSON-RPC request to Random.org API for generating blobs.
    async generateBlobs(params: BlobParams): Promise<BlobResult> { this.validateBlobParams(params); return this.makeRequest<BlobResult>('generateBlobs', params); }
  • Input validation helper for BlobParams used in generateBlobs.
    private validateBlobParams(params: BlobParams): void { if (params.n < 1 || params.n > 100) { throw new Error('n must be between 1 and 100'); } if (params.size < 1 || params.size > 1048576) { throw new Error('size must be between 1 and 1,048,576 bytes'); } if (params.format && !['base64', 'hex'].includes(params.format)) { throw new Error('format must be "base64" or "hex"'); } }

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