MCPcopy Index your code
hub / github.com/Noumena-Network/code / createUserMessage

Function createUserMessage

src/utils/messages.ts:461–524  ·  view source on GitHub ↗
({
  content,
  isMeta,
  isVisibleInTranscriptOnly,
  isVirtual,
  isCompactSummary,
  summarizeMetadata,
  toolUseResult,
  mcpMeta,
  uuid,
  timestamp,
  imagePasteIds,
  sourceToolAssistantUUID,
  permissionMode,
  origin,
}: {
  content: string | ContentBlockParam[]
  isMeta?: true
  isVisibleInTranscriptOnly?: true
  isVirtual?: true
  isCompactSummary?: true
  toolUseResult?: unknown // Matches tool's `Output` type
  /** MCP protocol metadata to pass through to SDK consumers (never sent to model) */
  mcpMeta?: {
    _meta?: Record<string, unknown>
    structuredContent?: Record<string, unknown>
  }
  uuid?: UUID | string
  timestamp?: string
  imagePasteIds?: number[]
  // For tool_result messages: the UUID of the assistant message containing the matching tool_use
  sourceToolAssistantUUID?: UUID
  // Permission mode when message was sent (for rewind restoration)
  permissionMode?: PermissionMode
  summarizeMetadata?: {
    messagesSummarized: number
    userContext?: string
    direction?: PartialCompactDirection
  }
  // Provenance of this message. undefined = human (keyboard).
  origin?: MessageOrigin
})

Source from the content-addressed store, hash-verified

459}
460
461export function createUserMessage({
462 content,
463 isMeta,
464 isVisibleInTranscriptOnly,
465 isVirtual,
466 isCompactSummary,
467 summarizeMetadata,
468 toolUseResult,
469 mcpMeta,
470 uuid,
471 timestamp,
472 imagePasteIds,
473 sourceToolAssistantUUID,
474 permissionMode,
475 origin,
476}: {
477 content: string | ContentBlockParam[]
478 isMeta?: true
479 isVisibleInTranscriptOnly?: true
480 isVirtual?: true
481 isCompactSummary?: true
482 toolUseResult?: unknown // Matches tool's `Output` type
483 /** MCP protocol metadata to pass through to SDK consumers (never sent to model) */
484 mcpMeta?: {
485 _meta?: Record<string, unknown>
486 structuredContent?: Record<string, unknown>
487 }
488 uuid?: UUID | string
489 timestamp?: string
490 imagePasteIds?: number[]
491 // For tool_result messages: the UUID of the assistant message containing the matching tool_use
492 sourceToolAssistantUUID?: UUID
493 // Permission mode when message was sent (for rewind restoration)
494 permissionMode?: PermissionMode
495 summarizeMetadata?: {
496 messagesSummarized: number
497 userContext?: string
498 direction?: PartialCompactDirection
499 }
500 // Provenance of this message. undefined = human (keyboard).
501 origin?: MessageOrigin
502}): UserMessage {
503 const m: UserMessage = {
504 type: 'user',
505 message: {
506 role: 'user',
507 content: content || NO_CONTENT_MESSAGE, // Make sure we don't send empty messages
508 },
509 isMeta,
510 isVisibleInTranscriptOnly,
511 isVirtual,
512 isCompactSummary,
513 summarizeMetadata,
514 uuid: (uuid as UUID | undefined) || randomUUID(),
515 timestamp: timestamp ?? new Date().toISOString(),
516 toolUseResult,
517 mcpMeta,
518 imagePasteIds,

Calls 1

randomUUIDFunction · 0.90

Tested by 4

createToolResultFixtureFunction · 0.40
renderMessageRowListNodeFunction · 0.40
createBashToolResultTurnFunction · 0.40