ChatMessage (Models.kt)

mobclaw · realtime

Data class representing a chat message with sender, content, and timestamp fields.

// Source: https://github.com/wamynobe/mobclaw | License: MIT | Copyright 2026 Huy
// Provided via justclaw.it.com; keep this notice with the code.
package com.mobclaw.android.model

import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonObject

/**
 * A single message in an LLM conversation.
 */
@Serializable
data class ChatMessage(
    val role: String,
    val content: String,
) {
    companion object {
        fun system(content: String) = ChatMessage("system", content)
        fun user(content: String) = ChatMessage("user", content)
        fun assistant(content: String) = ChatMessage("assistant", content)
        fun tool(content: String) = ChatMessage("tool", content)
    }
}

/**
 * Tool call requested by the LLM.
 */
@Serializable
data class ToolCall(
    

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key