Tool: list_messages
Retrieves messages from a specified Google Chat conversation (Space, direct message (DM) or group DM). Allows filtering by thread, time range, and number of messages. Additionally, the next page of messages can be retrieved to allow for more context. Private messages (messages only visible to a single user) are filtered out.
The following sample demonstrate how to use curl
to invoke the list_messages
MCP tool.
| Curl Request |
|---|
curl --location 'https://chatmcp.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "list_messages", "arguments": { // provide these details according to the tool MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for ListMessages RPC.
ListChatMessagesRequest
| JSON representation |
|---|
{ "conversationId" : string , "threadId" : string , "pageSize" : integer , "pageToken" : string , "startTime" : string , "endTime" : string } |
| Fields | |
|---|---|
conversationId
|
Required. The ID of the conversation. A conversation can either be a space, direct message (DM) or group DM/Chat. Format: spaces/{space} |
threadId
|
Optional. The ID of a specific thread within the conversation. If provided, only messages from this thread will be returned. If omitted, messages from all threads in the conversation are considered. Format: spaces/{space}/threads/{thread} |
pageSize
|
Optional. The maximum number of messages to return. The service may return fewer than this value. If unspecified, defaults to 20. The maximum allowed value is 50. |
pageToken
|
Optional. A page token, received from a previous list_messages call. Provide this to retrieve the subsequent page. |
startTime
|
Optional. ISO 8601 timestamp to filter messages. Only messages created after this time will be returned. |
endTime
|
Optional. ISO 8601 timestamp to filter messages. Only messages created before this time will be returned. |
Output Schema
Response message for ListMessages RPC.
ListChatMessagesResponse
| JSON representation |
|---|
{
"messages"
:
[
{
object (
|
| Fields | |
|---|---|
messages[]
|
List of messages retrieved, in reverse chronological order (newest first). |
nextPageToken
|
A token, which can be sent as |
ChatMessage
| JSON representation |
|---|
{ "messageId" : string , "threadId" : string , "plaintextBody" : string , "sender" : { object ( |
| Fields | |
|---|---|
messageId
|
Resource name of the message. Format: spaces/{space}/messages/{message} |
threadId
|
The thread this message belongs to. This will be empty if the message is unthreaded. Format: spaces/{space}/threads/{thread} |
plaintextBody
|
Plain text body of the message. |
sender
|
The sender of the message. |
createTime
|
Output only. Timestamp when the message was created. |
threadedReply
|
Whether message is a thread reply. |
attachments[]
|
Attachments included in the message. |
reactionSummaries[]
|
The emoji reactions summary included in the message. |
User
| JSON representation |
|---|
{
"userId"
:
string
,
"displayName"
:
string
,
"email"
:
string
,
"userType"
:
enum (
|
| Fields | |
|---|---|
userId
|
Resource name of a Chat user. Format: users/{user}. |
displayName
|
The display name of a Chat user. |
email
|
The email address of the user. This field is only populated when the user type is HUMAN. |
userType
|
The type of the user. |
ChatAttachmentMetadata
| JSON representation |
|---|
{
"attachmentId"
:
string
,
"filename"
:
string
,
"mimeType"
:
string
,
"source"
:
enum (
|
| Fields | |
|---|---|
attachmentId
|
Resource name of the attachment. Format: spaces/{space}/messages/{message}/attachments/{attachment}. |
filename
|
Name of the attachment. |
mimeType
|
Content type (MIME type). |
source
|
The source of the attachment. |
ReactionSummary
| JSON representation |
|---|
{ "emoji" : string , "count" : integer } |
| Fields | |
|---|---|
emoji
|
The emoji unicode string or custom emoji name. |
count
|
The total number of reactions using the associated emoji. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌

