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

Function checkForForcedToolUsage

apps/sim/providers/bedrock/utils.ts:47–69  ·  view source on GitHub ↗
(
  toolUseBlocks: Array<{ name: string }>,
  toolChoice: any,
  forcedTools: string[],
  usedForcedTools: string[]
)

Source from the content-addressed store, hash-verified

45}
46
47export function checkForForcedToolUsage(
48 toolUseBlocks: Array<{ name: string }>,
49 toolChoice: any,
50 forcedTools: string[],
51 usedForcedTools: string[]
52): { hasUsedForcedTool: boolean; usedForcedTools: string[] } | null {
53 if (typeof toolChoice === 'object' && toolChoice !== null && toolUseBlocks.length > 0) {
54 const adaptedToolCalls = toolUseBlocks.map((tool) => ({ name: tool.name }))
55 const adaptedToolChoice = toolChoice.tool
56 ? { function: { name: toolChoice.tool.name } }
57 : toolChoice
58
59 return trackForcedToolUsage(
60 adaptedToolCalls,
61 adaptedToolChoice,
62 logger,
63 'bedrock',
64 forcedTools,
65 usedForcedTools
66 )
67 }
68 return null
69}
70
71/**
72 * Generates a unique tool use ID for Bedrock.

Callers 1

index.tsFile · 0.90

Calls 1

trackForcedToolUsageFunction · 0.90

Tested by

no test coverage detected