Skip to main content

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​

ParameterTypeRequiredDescription
namespacestringYesNamespace to use: "dns", "url", "oid", "x500", or "custom".
namestringYesThe name string to hash (e.g. a domain name, URL, or other identifier).
custom_namespacestringYes (when namespace is "custom")A valid UUID string to use as the namespace (e.g. "550e8400-e29b-41d4-a716-446655440000").

Standard namespaces​

ValueNamespace UUIDIntended use
"dns"6ba7b810-9dad-11d1-80b4-00c04fd430c8Domain names
"url"6ba7b811-9dad-11d1-80b4-00c04fd430c8URLs
"oid"6ba7b812-9dad-11d1-80b4-00c04fd430c8ISO Object Identifiers
"x500"6ba7b814-9dad-11d1-80b4-00c04fd430c8X.500 Distinguished Names

Response​

FieldTypeDescription
uuidsarray of stringsA single-element array containing the generated UUID.
versionstringAlways "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).

CodeWhenDelivered as
invalid_argumentsnamespace or name is missing, or an argument is the wrong type.protocol error (invalid_params)
missing_custom_namespacecustom_namespace is missing when namespace is "custom".tool error (isError)
invalid_uuidcustom_namespace is not a valid UUID string.tool error (isError)
internal_errorAn 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.