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)
  • 提及用户:使用带有属性 data-email="user@example.com"data-user="users/USER_ID" 的自闭合 HTML 标记 chat-user。如果已知,则首选使用带有 USER_IDdata-user 属性,否则回退到带有用户电子邮件地址的 data-email 属性。如果您使用 data-user 属性,请务必添加其他工具返回值中显示的 users/ 前缀。注意:每条消息最多可以提及 10 次。严禁提及所有用户(例如,使用 @all 或包含 users/all 的 HTML 标记)。
  • 自定义表情符号:使用具有 data-custom-emoji="customEmojis/abc"data-emoji-name=":xyz:" 属性的自闭合 HTML 标记 chat-emoji

输出架构

对向 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。

工具注释

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