MCPcopy
hub / github.com/codeaashu/claude-code / tagMessagesWithToolUseID

Function tagMessagesWithToolUseID

src/tools/utils.ts:12–25  ·  view source on GitHub ↗
(
  messages: (UserMessage | AttachmentMessage | SystemMessage)[],
  toolUseID: string | undefined,
)

Source from the content-addressed store, hash-verified

10 * This prevents the "is running" message from being duplicated in the UI.
11 */
12export function tagMessagesWithToolUseID(
13 messages: (UserMessage | AttachmentMessage | SystemMessage)[],
14 toolUseID: string | undefined,
15): (UserMessage | AttachmentMessage | SystemMessage)[] {
16 if (!toolUseID) {
17 return messages
18 }
19 return messages.map(m => {
20 if (m.type === 'user') {
21 return { ...m, sourceToolUseID: toolUseID }
22 }
23 return m
24 })
25}
26
27/**
28 * Extracts the tool use ID from a parent message for a given tool name.

Callers 2

callFunction · 0.85
executeRemoteSkillFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected