工具:send_message
將 Google Chat 訊息傳送至對話,並套用 Markdown 格式。
這項工具會使用對話 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 |
必填。要傳送訊息的對話 ID (例如「spaces/AAAA...」)。 |
threadId |
(選用步驟) 要傳送訊息的執行緒 ID (例如「spaces/AAAA.../threads/BBBB...」)。如果未設定,系統會將訊息傳送至新討論串。 |
messageText |
必填。訊息的主要內容。你可以使用標準 Markdown 新增格式 (請注意,系統不支援表格)。支援的格式如下:
|
輸出內容的結構定義
傳送訊息至 Google Chat 對話的相關回應。
SendMessageResponse
| JSON 表示法 |
|---|
{
"message": {
object ( |
| 欄位 | |
|---|---|
message |
傳送的訊息。 |
ChatMessage
| JSON 表示法 |
|---|
{ "messageId": string, "threadId": string, "plaintextBody": string, "sender": { object ( |
| 欄位 | |
|---|---|
messageId |
訊息的資源名稱。格式:spaces/{space}/messages/{message} |
threadId |
這則訊息所屬的討論串。如果訊息未歸入任何討論串,這個欄位會是空白。格式:spaces/{space}/threads/{thread} |
plaintextBody |
使用 Markdown 格式設定的訊息內文。 |
sender |
訊息寄件者。 |
createTime |
僅供輸出。訊息建立時間的時間戳記。 |
threadedReply |
訊息是否為討論串回覆。 |
attachments[] |
郵件中包含的附件。 |
reactionSummaries[] |
訊息中包含的表情符號回應摘要。 |
使用者
| JSON 表示法 |
|---|
{
"userId": string,
"displayName": string,
"email": string,
"userType": enum ( |
| 欄位 | |
|---|---|
userId |
Chat 使用者的資源名稱。格式:users/{user}。 |
displayName |
Chat 使用者的顯示名稱。 |
email |
使用者的電子郵件地址。只有在使用者類型為「HUMAN」時,才會填寫這個欄位。 |
userType |
使用者類型。 |
ChatAttachmentMetadata
| JSON 表示法 |
|---|
{
"attachmentId": string,
"filename": string,
"mimeType": string,
"source": enum ( |
| 欄位 | |
|---|---|
attachmentId |
附件的資源名稱。格式:spaces/{space}/messages/{message}/attachments/{attachment}。 |
filename |
附件名稱。 |
mimeType |
內容類型 (MIME 類型)。 |
source |
附件來源。 |
ReactionSummary
| JSON 表示法 |
|---|
{ "emoji": string, "count": integer } |
| 欄位 | |
|---|---|
emoji |
表情符號 Unicode 字串或自訂表情符號名稱。 |
count |
使用相關聯表情符號的回應總數。 |
UserType
Google Chat 使用者類型。
| 列舉 | |
|---|---|
USER_TYPE_UNSPECIFIED |
未指明 |
HUMAN |
真人使用者。 |
APP |
應用程式使用者。 |
來源
附件來源。
| 列舉 | |
|---|---|
SOURCE_UNSPECIFIED |
保留。 |
DRIVE_FILE |
檔案是 Google 雲端硬碟檔案。 |
UPLOADED_CONTENT |
檔案會上傳到 Chat。 |
工具註解
破壞性提示:❌ | 等冪提示:❌ | 唯讀提示:❌ | 開放世界提示:✅