MCP Tools Reference: chatmcp.googleapis.com

工具:send_message

向采用 Markdown 格式的对话发送 Google Chat 消息。

此工具使用对话 ID、可选的帖子 ID 和消息文本作为输入。您可以使用 search_conversations 工具查找对话 ID。它会返回创建的消息。

以下示例演示了如何使用 curl 调用 send_message MCP 工具。

Curl 请求
curl --location 'https://chatmcp.googleapis.com/mcp/v1' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "send_message",
    "arguments": {
      // provide these details according to the tool MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

输入架构

请求向 Google Chat 对话发送消息。

SendMessageRequest

JSON 表示法
{
  "conversationId": string,
  "threadId": string,
  "messageText": string
}
字段
conversationId

string

必需。要向其发送消息的对话的 ID(例如“spaces/AAAA...”)。

threadId

string

可选。要向其发送消息的帖子的 ID(例如“spaces/AAAA.../threads/BBBB...”)。如果未设置,消息将发送到新帖子。

messageText

string

必需。消息的主要内容。您可以使用标准 Markdown 添加格式(请注意,系统不支持表格)。支持以下格式:

  • 粗体**text**
  • 斜体*text*_text_
  • 删除线~~text~~
  • 等宽字体text
  • 等宽字体块
```
line 1
line 2
```
  • 项目符号列表
* item 1
* item 2
  • 有序列表
1. item 1
2. item 2
  • 块引用> quoted text
  • 超链接[label](url)
  • 提及用户: 使用自闭合 HTML 标记 chat-user,并使用属性 data-email="user@example.com"data-name="USER_ID"。如果知道 USER_ID,请优先使用带有 USER_ID 的 data-name 属性,否则回退到带有用户电子邮件地址的 data-email 属性。如果您使用 data-name 属性,请务必使用原始数字 USER_ID,而不要包含在其他工具返回值中看到的 users/ 前缀。注意:每条消息最多允许提及 10 位用户。严禁提及所有用户(例如,使用 @all 或带有 users/all 的 HTML 标记)。
  • 自定义表情符号: 使用自闭合 HTML 标记 chat-custom-emoji,并使用属性 data-uid="abc"data-emoji-name=":xyz:"

输出架构

对向 Google Chat 对话发送消息的响应。

SendMessageResponse

JSON 表示法
{
  "message": {
    object (ChatMessage)
  }
}
字段
message

object (ChatMessage)

已发送的消息。

ChatMessage

JSON 表示法
{
  "messageId": string,
  "threadId": string,
  "plaintextBody": string,
  "sender": {
    object (User)
  },
  "createTime": string,
  "threadedReply": boolean,
  "attachments": [
    {
      object (ChatAttachmentMetadata)
    }
  ],
  "reactionSummaries": [
    {
      object (ReactionSummary)
    }
  ]
}
字段
messageId

string

消息的资源名称。格式:spaces/{space}/messages/{message}

threadId

string

此消息所属的帖子。如果消息未归入任何帖子,此字段将为空。格式:spaces/{space}/threads/{thread}

plaintextBody

string

使用 Markdown 格式的消息正文。

sender

object (User)

消息的发件人。

createTime

string

仅限输出。创建消息时的时间戳。

threadedReply

boolean

消息是否为帖子回复。

attachments[]

object (ChatAttachmentMetadata)

消息中包含的附件。

reactionSummaries[]

object (ReactionSummary)

消息中包含的表情符号回应摘要。

用户

JSON 表示法
{
  "userId": string,
  "displayName": string,
  "email": string,
  "userType": enum (UserType)
}
字段
userId

string

Chat 用户的资源名称。格式:users/{user}。

displayName

string

Chat 用户的显示名称。

email

string

用户的电子邮件地址。此字段仅在用户类型为 HUMAN 时填充。

userType

enum (UserType)

用户的类型。

ChatAttachmentMetadata

JSON 表示法
{
  "attachmentId": string,
  "filename": string,
  "mimeType": string,
  "source": enum (Source)
}
字段
attachmentId

string

附件的资源名称。格式:spaces/{space}/messages/{message}/attachments/{attachment}。

filename

string

附件的名称。

mimeType

string

内容类型(MIME 类型)。

source

enum (Source)

附件的来源。

ReactionSummary

JSON 表示法
{
  "emoji": string,
  "count": integer
}
字段
emoji

string

表情符号 Unicode 字符串或自定义表情符号名称。

count

integer

使用关联表情符号的回应总数。

UserType

Google Chat 用户的类型。

枚举
USER_TYPE_UNSPECIFIED 未指定。
HUMAN 人类用户。
APP 应用用户。

来源

附件的来源。

枚举
SOURCE_UNSPECIFIED 已预留。
DRIVE_FILE 该文件是 Google 云端硬盘文件。
UPLOADED_CONTENT 该文件已上传到 Chat。

工具注释

破坏性提示:❌ | 等幂性提示:❌ | 只读提示:❌ | 开放世界提示:✅