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

Function extractInboundMessageFields

src/bridge/inboundMessages.ts:21–40  ·  view source on GitHub ↗
(
  msg: SDKMessage,
)

Source from the content-addressed store, hash-verified

19 * skipped (non-user type, missing/empty content).
20 */
21export function extractInboundMessageFields(
22 msg: SDKMessage,
23):
24 | { content: string | Array<ContentBlockParam>; uuid: UUID | undefined }
25 | undefined {
26 if (msg.type !== 'user') return undefined
27 const content = msg.message?.content
28 if (!content) return undefined
29 if (Array.isArray(content) && content.length === 0) return undefined
30
31 const uuid =
32 'uuid' in msg && typeof msg.uuid === 'string'
33 ? (msg.uuid as UUID)
34 : undefined
35
36 return {
37 content: Array.isArray(content) ? normalizeImageBlocks(content) : content,
38 uuid,
39 }
40}
41
42/**
43 * Normalize image content blocks from bridge clients. iOS/web clients may

Callers 2

onInboundMessageFunction · 0.85
handleInboundMessageFunction · 0.85

Calls 1

normalizeImageBlocksFunction · 0.85

Tested by

no test coverage detected