Function: generateShortId()
@providerprotocol/ai / utils / generateShortId
Function: generateShortId()
Section titled “Function: generateShortId()”generateShortId(
prefix):string
Defined in: src/utils/id.ts:55
Generates a short alphanumeric identifier.
Creates a 12-character random string using alphanumeric characters (a-z, A-Z, 0-9). Useful for tool call IDs and other cases where a full UUID is not required.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string = ''
Optional prefix to prepend to the generated ID
Returns
Section titled “Returns”string
A string containing the prefix followed by 12 random alphanumeric characters
Example
Section titled “Example”const toolCallId = generateShortId('call_');// => "call_aB3xY9mK2pQr"
const simpleId = generateShortId();// => "Tz4wN8vL1sHj"