id_generate
Create UUID, ULID, or nanoid identifiers with secure randomness. Select UUID version, set nanoid alphabet and size, or generate deterministic v5 IDs using a namespace and name.
Instructions
Generate one or more identifiers (UUID / ULID / nanoid).
All randomness is drawn from the OS CSPRNG (secrets). kind selects the
family and which args apply. uuid honours version (default 4): v1 is
time-based with a random node ID rather than the host MAC, v4 is 122 random
bits, v5 is the SHA-1 of name within namespace (dns|url|oid|x500 or a
UUID string) and so is deterministic — a count above 1 repeats it — and v7
is a 48-bit millisecond timestamp plus 74 random bits, which sorts by
creation time. ulid is the same clock rendered as 26 Crockford base32
characters, also time-sortable. nanoid draws size (default 21) symbols from
alphabet (default 64 url-safe chars). Returns {kind, ids} plus the resolved
version (uuid) or size (nanoid).
Example: id_generate("uuid", version=5, namespace="dns", name="example.com")
-> ids ["cfbff0d1-9375-5685-968c-48ce8b15ae17"]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Identifier family: uuid (see `version`), ulid (time-sortable, 26 chars), or nanoid (custom `alphabet`/`size`). | |
| name | No | UUID v5 name hashed within `namespace`, e.g. a hostname. Required with version=5. | |
| size | No | Character count for kind=nanoid; default None means 21. | |
| count | No | How many IDs to generate, 1..1000; default 1. | |
| version | No | UUID version for kind=uuid: 1 (time+random node), 4 (random), 5 (SHA-1 of namespace+name), 7 (time-sortable). Default 4. | |
| alphabet | No | Symbol set for kind=nanoid; default None uses the standard 64-char url-safe alphabet [A-Za-z0-9_-]. | |
| namespace | No | UUID v5 namespace: dns|url|oid|x500, or a UUID string. Required with version=5. |