MCPcopy
hub / github.com/TanStack/ai / findToolResultPart

Function findToolResultPart

packages/ai-client/tests/chat-client-context.test.ts:26–43  ·  view source on GitHub ↗
(client: ChatClient, toolCallId: string)

Source from the content-addressed store, hash-verified

24}
25
26function findToolResultPart(client: ChatClient, toolCallId: string) {
27 for (const message of client.getMessages()) {
28 if (message.role !== 'assistant') {
29 continue
30 }
31
32 const part = message.parts.find(
33 (messagePart) =>
34 messagePart.type === 'tool-result' &&
35 messagePart.toolCallId === toolCallId,
36 )
37 if (part) {
38 return part
39 }
40 }
41
42 return undefined
43}
44
45describe('ChatClient runtime context', () => {
46 it('passes client-local context to client tool execution without serializing it', async () => {

Callers 1

Calls 1

getMessagesMethod · 0.45

Tested by

no test coverage detected