Skip to main content
Glama
okoshi-f

Random Value MCP Server

by okoshi-f

generate_random_string

Generate random alphanumeric strings of specified length for testing, security tokens, or unique identifiers.

Instructions

Generate a random string of specified length using alphanumeric characters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lengthYesLength of the string to generate

Implementation Reference

  • The handler implementation for generate_random_string, which validates the input length and generates a random alphanumeric string.
    case "generate_random_string": {
      const { length } = args as { length: number };
      
      if (length < 1) {
        throw new Error("String length must be at least 1");
      }
      
      const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
      let result = "";
      
      for (let i = 0; i < length; i++) {
        result += characters.charAt(Math.floor(Math.random() * characters.length));
      }
      
      return {
        content: [
          {
            type: "text",
            text: `Generated random string: ${result}`,
          },
        ],
      };
    }
  • The registration and schema definition for the generate_random_string tool.
    {
      name: "generate_random_string",
      description: "Generate a random string of specified length using alphanumeric characters",
      inputSchema: {
        type: "object",
        properties: {
          length: {
            type: "number",
            description: "Length of the string to generate",
            minimum: 1,
          },
        },
        required: ["length"],
      },
    },
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/okoshi-f/random-value-mcp-server'

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