MCP Tools Reference: chatmcp.googleapis.com

工具:send_message

向对话发送 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
  • 等宽字体块
```
line 1
line 2
```
  • 项目符号列表
* item 1
* item 2
  • 块引用> quoted text
  • 超链接<url|display text>
  • 提及用户<users/{user_id}>

输出架构

向 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

消息的纯文本正文。

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。

工具注释

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