generateUuid
Create unique, timestamp-based UUIDs (v7) without input parameters, ensuring chronological sorting and uniqueness for efficient identifier generation.
Instructions
Generate a UUID v7 that's timestamp-based and guaranteed to be unique
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:40-52 (handler)Handler for the 'generateUuid' tool. Checks if the requested tool name is 'generateUuid', generates a UUID v7 using the uuidv7() function, and returns it as text content in the response format expected by MCP.if (request.params.name === "generateUuid") { // UUID v7 is timestamp-based with additional random data for uniqueness const uuid = uuidv7(); return { content: [ { type: "text", text: uuid } ] }; }
- src/index.ts:23-30 (schema)Tool schema definition advertised in the tools/list response, including name, description, and empty inputSchema (no parameters required).{ name: "generateUuid", description: "Generate a UUID v7 that's timestamp-based and guaranteed to be unique", inputSchema: { type: "object", properties: {} } }
- src/index.ts:18-34 (registration)Registration of the tools/list handler, which advertises the 'generateUuid' tool to MCP clients.server.setRequestHandler( ListToolsRequestSchema, async () => { return { tools: [ { name: "generateUuid", description: "Generate a UUID v7 that's timestamp-based and guaranteed to be unique", inputSchema: { type: "object", properties: {} } } ] }; } );
- src/index.ts:4-4 (helper)Import of the uuidv7 function from the 'uuid' library, used as the core utility to generate UUID v7 in the tool handler.import { v7 as uuidv7 } from 'uuid';