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

Function extractFirstUserMessageText

src/utils/sideQuery.ts:69–79  ·  view source on GitHub ↗

* Extract text from first user message for fingerprint computation.

(messages: MessageParam[])

Source from the content-addressed store, hash-verified

67 * Extract text from first user message for fingerprint computation.
68 */
69function extractFirstUserMessageText(messages: MessageParam[]): string {
70 const firstUserMessage = messages.find(m => m.role === 'user')
71 if (!firstUserMessage) return ''
72
73 const content = firstUserMessage.content
74 if (typeof content === 'string') return content
75
76 // Array of content blocks - find first text block
77 const textBlock = content.find(block => block.type === 'text')
78 return textBlock?.type === 'text' ? textBlock.text : ''
79}
80
81/**
82 * Lightweight API wrapper for "side queries" outside the main conversation loop.

Callers 1

sideQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected