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

Function extractFirstUserMessageText

src/utils/sideQuery.ts:103–113  ·  view source on GitHub ↗

* Extract text from first user message for fingerprint computation.

(messages: MessageParam[])

Source from the content-addressed store, hash-verified

101 * Extract text from first user message for fingerprint computation.
102 */
103function extractFirstUserMessageText(messages: MessageParam[]): string {
104 const firstUserMessage = messages.find(m => m.role === 'user')
105 if (!firstUserMessage) return ''
106
107 const content = firstUserMessage.content
108 if (typeof content === 'string') return content
109
110 // Array of content blocks - find first text block
111 const textBlock = content.find(block => block.type === 'text')
112 return textBlock?.type === 'text' ? textBlock.text : ''
113}
114
115/**
116 * Extract system prompt text from the `system` option.

Callers 1

sideQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected