Skip to main content
Glama
drdudda-org

My Little MCP Server

by drdudda-org

랜덤 숫자 생성

get_random_number

Generate a random number between 1 and 50, or customize the range from 1 to 100 for applications requiring random numeric values.

Instructions

1부터 50 사이의 랜덤한 숫자를 하나 뽑아주는 도구입니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
minNo최소값 (기본값: 1)
maxNo최대값 (기본값: 50)

Implementation Reference

  • The MCP tool handler that calls the random number generator helper and formats the response as text content.
    async ({ min = 1, max = 50 }) => {
      const randomNumber = getRandomNumber(min, max);
      return {
        content: [{ 
          type: "text", 
          text: `랜덤 숫자 (${min}~${max}): ${randomNumber}` 
        }]
      };
    }
  • Input schema using Zod for validating min and max parameters with descriptions.
    inputSchema: {
      min: z.number().min(1).max(100).optional().describe("최소값 (기본값: 1)"),
      max: z.number().min(1).max(100).optional().describe("최대값 (기본값: 50)")
    }
  • src/index.ts:77-96 (registration)
    Registration of the 'get_random_number' tool using server.registerTool, including title, description, input schema, and handler.
    server.registerTool(
      "get_random_number",
      {
        title: "랜덤 숫자 생성",
        description: "1부터 50 사이의 랜덤한 숫자를 하나 뽑아주는 도구입니다.",
        inputSchema: {
          min: z.number().min(1).max(100).optional().describe("최소값 (기본값: 1)"),
          max: z.number().min(1).max(100).optional().describe("최대값 (기본값: 50)")
        }
      },
      async ({ min = 1, max = 50 }) => {
        const randomNumber = getRandomNumber(min, max);
        return {
          content: [{ 
            type: "text", 
            text: `랜덤 숫자 (${min}~${max}): ${randomNumber}` 
          }]
        };
      }
    );
  • Utility function that generates a random integer between min and max (clamped to 1-100), used by the tool handler.
    function getRandomNumber(min: number = 1, max: number = 50): number {
      // Ensure min and max are within bounds
      min = Math.max(1, Math.min(min, 100));
      max = Math.max(1, Math.min(max, 100));
      
      // Ensure min <= max
      if (min > max) {
        [min, max] = [max, min];
      }
      
      return Math.floor(Math.random() * (max - min + 1)) + min;
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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/drdudda-org/my-little-mcp'

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