MCPcopy Index your code
hub / github.com/simstudioai/sim / generateToolUseId

Function generateToolUseId

apps/sim/providers/bedrock/utils.ts:75–82  ·  view source on GitHub ↗
(toolName: string)

Source from the content-addressed store, hash-verified

73 * AWS Bedrock requires toolUseId to be 1-64 characters, pattern [a-zA-Z0-9_-]+
74 */
75export function generateToolUseId(toolName: string): string {
76 const timestamp = Date.now().toString(36) // Base36 timestamp (9 chars)
77 const random = randomFloat().toString(36).substring(2, 7) // 5 random chars
78 const suffix = `-${timestamp}-${random}` // ~15 chars
79 const maxNameLength = 64 - suffix.length
80 const truncatedName = toolName.substring(0, maxNameLength).replace(/[^a-zA-Z0-9_-]/g, '_')
81 return `${truncatedName}${suffix}`
82}
83
84/**
85 * Models whose AWS model cards state geo/cross-region inference profiles are

Callers 1

index.tsFile · 0.90

Calls 3

randomFloatFunction · 0.90
replaceMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected