Skip to main content
Glama
VeriTeknik

Pluggedin Random Number Generator

generate_random_boolean

Generate cryptographically secure random boolean values with customizable counts and probability settings. Ideal for simulations, testing, and decision-making applications.

Instructions

Generate cryptographically secure random boolean values

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of random booleans to generate
probabilityNoProbability of true (0.0 to 1.0)

Implementation Reference

  • The core handler function implementing the generate_random_boolean tool. It generates an array of random booleans using Node.js crypto.randomBytes for cryptographic security, respecting count and probability parameters, and returns a structured JSON response.
    private async generateRandomBoolean(args: any) {
      const count = args.count ?? 1;
      const probability = args.probability ?? 0.5;
    
      if (count < 1 || count > 1000) {
        throw new Error("Count must be between 1 and 1000");
      }
    
      if (probability < 0.0 || probability > 1.0) {
        throw new Error("Probability must be between 0.0 and 1.0");
      }
    
      const results: boolean[] = [];
      for (let i = 0; i < count; i++) {
        const randomBuffer = randomBytes(4);
        const randomValue = randomBuffer.readUInt32BE(0) / 0xFFFFFFFF;
        results.push(randomValue < probability);
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify({
              type: "random_booleans",
              values: results,
              parameters: { count, probability },
              timestamp: new Date().toISOString(),
            }, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the generate_random_boolean tool, specifying parameters for count (1-1000) and probability (0.0-1.0) with defaults.
    inputSchema: {
      type: "object",
      properties: {
        count: {
          type: "integer",
          description: "Number of random booleans to generate",
          default: 1,
          minimum: 1,
          maximum: 1000,
        },
        probability: {
          type: "number",
          description: "Probability of true (0.0 to 1.0)",
          default: 0.5,
          minimum: 0.0,
          maximum: 1.0,
        },
      },
      required: [],
    },
  • src/index.ts:215-238 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and input schema for generate_random_boolean.
    {
      name: "generate_random_boolean",
      description: "Generate cryptographically secure random boolean values",
      inputSchema: {
        type: "object",
        properties: {
          count: {
            type: "integer",
            description: "Number of random booleans to generate",
            default: 1,
            minimum: 1,
            maximum: 1000,
          },
          probability: {
            type: "number",
            description: "Probability of true (0.0 to 1.0)",
            default: 0.5,
            minimum: 0.0,
            maximum: 1.0,
          },
        },
        required: [],
      },
    },
  • src/index.ts:261-262 (registration)
    Dispatch registration in the CallToolRequestSchema switch statement, routing calls to generate_random_boolean to the handler method.
    case "generate_random_boolean":
      return await this.generateRandomBoolean(args);
Behavior3/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 adds value by specifying 'cryptographically secure', which implies high randomness quality and security considerations beyond basic generation. However, it doesn't detail output format, error handling, or performance traits like rate limits, leaving gaps in behavioral context.

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 function without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes essential information, earning its place.

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 low complexity (simple generation with two well-documented parameters) and no output schema, the description is minimally adequate. It covers the basic purpose and security aspect but lacks details on output format or usage scenarios. With no annotations, it should do more to compensate, but the simplicity keeps it from being severely incomplete.

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 fully documents both parameters (count and probability). The description adds no parameter-specific information beyond what the schema provides, such as examples or edge cases. Baseline 3 is appropriate as the schema handles the heavy lifting without extra value from the description.

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 the resource 'cryptographically secure random boolean values', making the purpose specific and understandable. It distinguishes from siblings by specifying 'boolean' values rather than bytes, choices, floats, etc., though it doesn't explicitly contrast with them.

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_choice or generate_random_integer for boolean-like outcomes. It lacks context about typical use cases or prerequisites, offering only a basic functional statement without comparative or exclusionary advice.

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