MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getSiblingToolUseIDs

Function getSiblingToolUseIDs

src/utils/messages.ts:1115–1144  ·  view source on GitHub ↗
(
  message: NormalizedMessage,
  messages: Message[],
)

Source from the content-addressed store, hash-verified

1113}
1114
1115export function getSiblingToolUseIDs(
1116 message: NormalizedMessage,
1117 messages: Message[],
1118): Set<string> {
1119 const toolUseID = getToolUseID(message)
1120 if (!toolUseID) {
1121 return new Set()
1122 }
1123
1124 const unnormalizedMessage = messages.find(
1125 (_): _ is AssistantMessage =>
1126 _.type === 'assistant' &&
1127 _.message.content.some(_ => _.type === 'tool_use' && _.id === toolUseID),
1128 )
1129 if (!unnormalizedMessage) {
1130 return new Set()
1131 }
1132
1133 const messageID = unnormalizedMessage.message.id
1134 const siblingMessages = messages.filter(
1135 (_): _ is AssistantMessage =>
1136 _.type === 'assistant' && _.message.id === messageID,
1137 )
1138
1139 return new Set(
1140 siblingMessages.flatMap(_ =>
1141 _.message.content.filter(_ => _.type === 'tool_use').map(_ => _.id),
1142 ),
1143 )
1144}
1145
1146export type MessageLookups = {
1147 siblingToolUseIDs: Map<string, Set<string>>

Callers

nothing calls this directly

Calls 1

getToolUseIDFunction · 0.85

Tested by

no test coverage detected