MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / createUserMessage

Function createUserMessage

src/utils/messages.ts:463–526  ·  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

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

Callers 15

makeUserMsgFunction · 0.90
messages.test.tsFile · 0.90
executeRemoteSkillFunction · 0.85
callInnerFunction · 0.85
searchMethod · 0.85
callFunction · 0.85
resumeAgentBackgroundFunction · 0.85
runAgentFunction · 0.85
callFunction · 0.85
buildForkedMessagesFunction · 0.85

Calls

no outgoing calls

Tested by 1

makeUserMsgFunction · 0.72