generateUuid
Generate timestamp-based UUID v7 identifiers for chronologically sortable unique IDs. Specify count parameter to create multiple identifiers at once.
Instructions
Generate one or more UUID v7s (timestamp-based). Specify count to get multiple.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | How many UUID v7 strings to generate (defaults to 1) |
Implementation Reference
- src/index.ts:43-61 (handler)Handler logic for the generateUuid tool: extracts count from arguments (default 1), generates that many UUID v7s using uuidv7(), and returns them as newline-separated text content.if (request.params.name === "generateUuid") { // Pull from params.arguments per MCP spec const raw = request.params.arguments?.count; const count = typeof raw === "number" && raw >= 1 ? raw : 1; const uuids: string[] = []; for (let i = 0; i < count; i++) { uuids.push(uuidv7()); } return { content: [ { type: "text", text: uuids.join("\n") } ] }; }
- src/index.ts:22-32 (schema)Input schema definition for generateUuid tool: object with optional 'count' integer property (min 1).inputSchema: { type: "object", properties: { count: { type: "integer", minimum: 1, description: "How many UUID v7 strings to generate (defaults to 1)" } }, additionalProperties: false }
- src/index.ts:14-37 (registration)Registers the generateUuid tool by handling ListToolsRequest and returning the tool metadata including name, description, and inputSchema.server.setRequestHandler( ListToolsRequestSchema, async () => { return { tools: [ { name: "generateUuid", description: "Generate one or more UUID v7s (timestamp-based). Specify `count` to get multiple.", inputSchema: { type: "object", properties: { count: { type: "integer", minimum: 1, description: "How many UUID v7 strings to generate (defaults to 1)" } }, additionalProperties: false } } ] }; } );
- src/index.ts:3-3 (helper)Imports the uuidv7 function used to generate UUIDs in the handler.import { v7 as uuidv7 } from "uuid";