MCPcopy Create free account
hub / github.com/Noumena-Network/code / countToolsInMessages

Function countToolsInMessages

src/services/PromptSuggestion/speculation.ts:156–165  ·  view source on GitHub ↗
(messages: Message[])

Source from the content-addressed store, hash-verified

154}
155
156function countToolsInMessages(messages: Message[]): number {
157 const blocks = messages
158 .filter(isUserMessageWithArrayContent)
159 .flatMap(m => m.message.content)
160 .filter(
161 (b): b is { type: string; is_error?: boolean } =>
162 typeof b === 'object' && b !== null && 'type' in b,
163 )
164 return count(blocks, b => b.type === 'tool_result' && !b.is_error)
165}
166
167function getBoundaryTool(
168 boundary: CompletionBoundary | null,

Callers 3

logSpeculationFunction · 0.85
startSpeculationFunction · 0.85

Calls 1

countFunction · 0.85

Tested by

no test coverage detected