Skip to main content
Glama
okoshi-f

Random Value MCP Server

by okoshi-f

generate_random_number

Generate a random integer within a specified range using minimum and maximum values. This tool creates random numbers for applications requiring randomization.

Instructions

Generate a random integer within a specified range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
minYesMinimum value (inclusive)
maxYesMaximum value (inclusive)

Implementation Reference

  • The handler implementation for 'generate_random_number' inside the CallToolRequestSchema switch case.
    case "generate_random_number": {
      const { min, max } = args as { min: number; max: number };
      
      if (min > max) {
        throw new Error("Minimum value cannot be greater than maximum value");
      }
      
      const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min;
      
      return {
        content: [
          {
            type: "text",
            text: `Generated random number: ${randomNumber}`,
          },
        ],
      };
    }
  • The tool registration and schema definition for 'generate_random_number' within the ListToolsRequestSchema handler.
    {
      name: "generate_random_number",
      description: "Generate a random integer within a specified range",
      inputSchema: {
        type: "object",
        properties: {
          min: {
            type: "number",
            description: "Minimum value (inclusive)",
          },
          max: {
            type: "number", 
            description: "Maximum value (inclusive)",
          },
        },
        required: ["min", "max"],
      },
    },
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