MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / normalizeMistralToolCallId

Function normalizeMistralToolCallId

src/api/transform/mistral-format.ts:19–30  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

17 * @returns A normalized 9-character alphanumeric ID compatible with Mistral
18 */
19export function normalizeMistralToolCallId(id: string): string {
20 // Extract only alphanumeric characters
21 const alphanumeric = id.replace(/[^a-zA-Z0-9]/g, "")
22
23 // Take first 9 characters, or pad with zeros if shorter
24 if (alphanumeric.length >= 9) {
25 return alphanumeric.slice(0, 9)
26 }
27
28 // Pad with zeros to reach 9 characters
29 return alphanumeric.padEnd(9, "0")
30}
31
32export type MistralMessage =
33 | (SystemMessage & { role: "system" })

Callers 3

convertToMistralMessagesFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected