uuid MCP tool: generate and inspect UUIDs from an AI agent
· 6 min read
Get the devtoolbox.cc MCP serverOpen the UUID tool
Ask a model for ten UUIDs and you’ll get ten strings in the right shape. They aren’t random in any useful sense. A model picks likely tokens, so its “random” hex has patterns, repeats across conversations more often than it should, and frequently gets the version and variant digits wrong. For a v7 UUID it can’t do it at all, since the first 12 hex digits must encode the current time in milliseconds, and the model doesn’t know the time.
The devtoolbox.cc MCP server has a uuid tool that generates them properly, from the operating system’s cryptographic random generator and the real clock. It also reads existing UUIDs back: version, variant and, for time-based versions, the embedded creation time. It’s the same code as the UUID generator on this site. Install instructions are on the MCP page.
What the tool does
In generate mode it creates 1 to 1,000 UUIDs per call, one per line:
- Version 4: 122 random bits. The general-purpose choice.
- Version 7: a 48-bit Unix timestamp in milliseconds followed by random bits (RFC 9562). New values sort after older ones, which keeps database indexes compact.
Output can be lowercase (the default), uppercase, without hyphens, or wrapped in braces as some Windows APIs expect. UUIDs generated in one call within the same millisecond are sorted, so a v7 batch stays in order.
In inspect mode it takes any UUID, in any of those spellings or as a urn:uuid: URN, and reports its normalized form, version, variant and, for versions 1, 6 and 7, the time inside it. The nil and max UUIDs are recognised by name.
Arguments
| Argument | Type | Meaning |
|---|---|---|
version |
4 or 7 |
Version to generate. Default 4. |
count |
integer | How many, from 1 to 1,000. Default 1. |
uppercase |
boolean | Uppercase hex. |
hyphens |
boolean | Include hyphens. Default true. |
braces |
boolean | Wrap each UUID in {…}. |
inspect |
string | A UUID to inspect instead of generating new ones. |
Examples
These examples were run against the real tool. Generated UUIDs are different on every call, so the ones below are only a sample of what you’ll see.
Three v7 UUIDs:
{ "version": 7, "count": 3 }
01a16dc2-7a72-71b9-b71d-a4c86886332e
01a16dc2-7a72-7295-beeb-3218c6aacbfa
01a16dc2-7a72-74bf-9cee-0c5e913b0b3e
The first 12 hex digits are the time, which is why all three start the same: they were made in the same millisecond. The rest is random.
Two v4 UUIDs in the format of the Windows registry:
{ "count": 2, "uppercase": true, "braces": true }
{9E935214-BD5C-4D55-95BD-DAD75A16251C}
{E93E237F-1007-4919-8592-58638C525574}
Inspecting a v7 UUID shows when it was created, which is often enough to date a database row from its ID alone:
{ "inspect": "017F22E2-79B0-7CC3-98C4-DC0C0C07398F" }
UUID: 017f22e2-79b0-7cc3-98c4-dc0c0c07398f
Version: 7
Variant: RFC 9562
Time: 2022-02-22T19:22:22.000Z
A v4 UUID has no time in it, and the tool doesn’t invent one:
{ "inspect": "urn:uuid:620f0d6a-ede0-4e7b-acd2-c54147ac5291" }
UUID: 620f0d6a-ede0-4e7b-acd2-c54147ac5291
Version: 4
Variant: RFC 9562
The nil UUID is all zeros and is used as a “no value” marker:
{ "inspect": "00000000-0000-0000-0000-000000000000" }
UUID: 00000000-0000-0000-0000-000000000000
Version: 0
Variant: NCS
Special: nil UUID
Limits and bad input are reported, not silently adjusted:
{ "count": 5000 }
count must be from 1 to 1,000
{ "inspect": "1234-not-a-uuid" }
Not a valid UUID (expected 32 hex digits)
Older time-based versions
Versions 1 and 6 also contain a timestamp, counted in 100-nanosecond intervals since 1582-10-15, the start of the Gregorian calendar. Version 1 stores it in a scrambled order, and version 6 reorders it so the UUIDs sort by time. The test vectors from RFC 9562 decode to the same moment as the v7 example above:
{ "inspect": "C232AB00-9414-11EC-B3C8-9F6BDECED846" }
UUID: c232ab00-9414-11ec-b3c8-9f6bdeced846
Version: 1
Variant: RFC 9562
Time: 2022-02-22T19:22:22.000Z
{ "inspect": "1EC9414C-232A-6B00-B3C8-9F6BDECED846" }
UUID: 1ec9414c-232a-6b00-b3c8-9f6bdeced846
Version: 6
Variant: RFC 9562
Time: 2022-02-22T19:22:22.000Z
Version 1 UUIDs historically also embedded the MAC address of the machine that created them, which is one reason v4 replaced them in most systems.
Spellings and storage
The same UUID shows up in several spellings: lowercase with hyphens (the canonical form), uppercase, without hyphens as 32 hex digits, in braces as Windows tools print it, or as a urn:uuid: URN. The tool accepts all of them for inspect and reports the canonical lowercase form, so an agent can normalise IDs from different sources before comparing them. In a database, store UUIDs in a native type (uuid in PostgreSQL) or as 16 bytes (BINARY(16) in MySQL) rather than as 36-character text, which takes more than twice the space and compares more slowly.
Things to ask your assistant
- “Generate 200 v7 UUIDs for the seed data in
seed/users.sql.” - “When was the record with ID
018f6c3a-…created?” - “Which version are the IDs in
export.csv? Are they all the same version?” - “Replace the placeholder IDs in
fixtures.jsonwith fresh v4 UUIDs.”
The last request is a good example of how tools combine: the agent calls uuid once with the count it needs, then edits the file. The IDs come from a real random source, not from the model’s idea of what random looks like.
For quick use in the browser, the UUID generator on this site creates the same versions and inspects pasted UUIDs. The embedded time of a v7 UUID can be checked in the Unix timestamp converter too.
v4 or v7
For most new database keys, v7 is the better default: it’s as unique as v4 in practice, and because it’s time-ordered, inserts go to the end of a B-tree index instead of a random page. The cost is that anyone who sees the ID can read its creation time. For IDs that appear in public URLs where creation time is sensitive, v4 is the safer choice. The UUID v4 vs v7 article goes through the trade-offs.
Whichever version you pick, a UUID is an identifier, not a secret. Session tokens and password reset links need a dedicated random token, not a UUID.
Install
uuid is one of the tools in the devtoolbox.cc MCP server. It runs locally and makes no network requests. Setup for Claude Desktop, Claude Code, Cursor and VS Code is on the MCP install page.