Skip to main content
Glama
VeriTeknik

Pluggedin Random Number Generator

generate_random_bytes

Create cryptographically secure random bytes for encryption or data security. Specify length and encoding (hex, base64, binary) for tailored output. Ideal for secure key generation or sensitive data handling.

Instructions

Generate cryptographically secure random bytes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encodingNoOutput encoding formathex
lengthNoNumber of random bytes to generate

Implementation Reference

  • The core handler function that generates cryptographically secure random bytes using Node.js crypto.randomBytes. Supports length (1-1024 bytes, default 32) and encoding (hex, base64, binary). Returns JSON with the result.
    private async generateRandomBytes(args: any) {
      const length = args.length ?? 32;
      const encoding = args.encoding ?? "hex";
    
      if (length < 1 || length > 1024) {
        throw new Error("Length must be between 1 and 1024");
      }
    
      const bytes = randomBytes(length);
      let result: string;
    
      switch (encoding) {
        case "hex":
          result = bytes.toString("hex");
          break;
        case "base64":
          result = bytes.toString("base64");
          break;
        case "binary":
          result = bytes.toString("binary");
          break;
        default:
          throw new Error("Invalid encoding. Must be 'hex', 'base64', or 'binary'");
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              type: "random_bytes",
              value: result,
              parameters: { length, encoding },
              timestamp: new Date().toISOString(),
            }, null, 2),
          },
        ],
      };
    }
  • Input schema for the generate_random_bytes tool, defining parameters: length (integer, 1-1024, default 32) and encoding (string enum: hex/base64/binary, default hex).
    inputSchema: {
      type: "object",
      properties: {
        length: {
          type: "integer",
          description: "Number of random bytes to generate",
          default: 32,
          minimum: 1,
          maximum: 1024,
        },
        encoding: {
          type: "string",
          description: "Output encoding format",
          enum: ["hex", "base64", "binary"],
          default: "hex",
        },
      },
      required: [],
    },
  • src/index.ts:110-132 (registration)
    Tool registration in the ListTools response, including name, description, and reference to inputSchema.
    {
      name: "generate_random_bytes",
      description: "Generate cryptographically secure random bytes",
      inputSchema: {
        type: "object",
        properties: {
          length: {
            type: "integer",
            description: "Number of random bytes to generate",
            default: 32,
            minimum: 1,
            maximum: 1024,
          },
          encoding: {
            type: "string",
            description: "Output encoding format",
            enum: ["hex", "base64", "binary"],
            default: "hex",
          },
        },
        required: [],
      },
    },
  • src/index.ts:253-254 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the generateRandomBytes method.
    case "generate_random_bytes":
      return await this.generateRandomBytes(args);
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 'cryptographically secure,' which hints at quality and safety, but doesn't address potential side effects, rate limits, or response format. For a tool with zero annotation coverage, this leaves significant gaps in understanding its operational behavior.

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 directly states the tool's purpose without any fluff. It's front-loaded and appropriately sized, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like security implications, performance, or return format, which are crucial for a tool generating random data. The minimal information provided is insufficient for full contextual understanding.

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 adds no parameter-specific information beyond what the schema already provides (100% coverage). It doesn't explain the semantics of 'length' or 'encoding' in the context of random bytes generation. Since the schema fully documents parameters, the baseline score of 3 is appropriate.

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 verb ('generate') and resource ('cryptographically secure random bytes'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like generate_random_string or generate_random_integer, which would require a 5.

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 generate_random_string or generate_random_integer. It lacks context about scenarios where raw bytes are preferred over other random data types, offering no usage boundaries or prerequisites.

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

Related 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/VeriTeknik/pluggedin-random-number-generator-mcp'

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