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

Function extractInboundMessageFields

src/bridge/inboundMessages.ts:21–42  ·  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 = (
28 msg.message as { content?: string | Array<ContentBlockParam> } | undefined
29 )?.content
30 if (!content) return undefined
31 if (Array.isArray(content) && content.length === 0) return undefined
32
33 const uuid =
34 'uuid' in msg && typeof msg.uuid === 'string'
35 ? (msg.uuid as UUID)
36 : undefined
37
38 return {
39 content: Array.isArray(content) ? normalizeImageBlocks(content) : content,
40 uuid,
41 }
42}
43
44/**
45 * 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