uuid_generate_v5
Generate a deterministic UUID v5 using the SHA-1 hash of a namespace UUID and a name string. The same namespace and name always produce the same UUID.
v5 is preferred over uuid_generate_v3 for new applications because SHA-1 is more collision-resistant than MD5.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | Yes | Namespace to use: "dns", "url", "oid", "x500", or "custom". |
name | string | Yes | The name string to hash (e.g. a domain name, URL, or other identifier). |
custom_namespace | string | Yes (when namespace is "custom") | A valid UUID string to use as the namespace (e.g. "550e8400-e29b-41d4-a716-446655440000"). |
Standard namespaces
| Value | Namespace UUID | Intended use |
|---|---|---|
"dns" | 6ba7b810-9dad-11d1-80b4-00c04fd430c8 | Domain names |
"url" | 6ba7b811-9dad-11d1-80b4-00c04fd430c8 | URLs |
"oid" | 6ba7b812-9dad-11d1-80b4-00c04fd430c8 | ISO Object Identifiers |
"x500" | 6ba7b814-9dad-11d1-80b4-00c04fd430c8 | X.500 Distinguished Names |
Response
| Field | Type | Description |
|---|---|---|
uuids | array of strings | A single-element array containing the generated UUID. |
version | string | Always "v5". |
Examples
Generate a v5 UUID from a domain name
{
"namespace": "dns",
"name": "example.com"
}
Result:
{
"uuids": ["cfbff0d1-9375-5685-968c-48ce8b15ae17"],
"version": "v5"
}
Generate a v5 UUID with a custom namespace
{
"namespace": "custom",
"custom_namespace": "550e8400-e29b-41d4-a716-446655440000",
"name": "my-identifier"
}
Result:
{
"uuids": ["a095bc00-d58e-50a6-83c7-095f3a8406ad"],
"version": "v5"
}
Errors
Each failure carries a precise code in the response. Argument-schema and server errors are JSON-RPC protocol errors; a rejected value is returned as a tool result with isError: true (so the agent can read the code and self-correct).
| Code | When | Delivered as |
|---|---|---|
invalid_arguments | namespace or name is missing, or an argument is the wrong type. | protocol error (invalid_params) |
missing_custom_namespace | custom_namespace is missing when namespace is "custom". | tool error (isError) |
invalid_uuid | custom_namespace is not a valid UUID string. | tool error (isError) |
internal_error | An unexpected server error. | protocol error (internal_error) |
Notes
- The result is always a single-element array.
- Calling this tool twice with the same inputs always returns the same UUID.
- v3 and v5 produce different UUIDs for identical inputs because they use different hash algorithms.