Skip to the documentation
MCP server

Assistant chats

The conversations held with the assistant in the app.

Assistant chats tools

ToolWhat it does
listChatsThe chats held with the assistant in the app, newest first, with their titles and how many messages each holds. query searches the titles. Returned a page at a time.
getChatOne chat by its id.
renameChatGive a chat a new title.
deleteChatDelete a chat and every message in it, for good. Nothing the assistant did in the mailbox is undone.
listChatMessagesThe messages of one chat, from the first unless order is desc: what was said, and each tool the assistant called with its status and arguments. Returned a page at a time.
sendChatMessageSay something in a chat and get the turn back once the assistant has replied. An id that names no chat yet starts one, and regenerate answers your last message again. Give the call a long timeout, since it answers only once the turn has ended.
stopChatTurnStop the assistant while it answers, in the app or through sendChatMessage, keeping what it had written. When nothing runs, nothing changes.
approveChatToolCallLet the assistant run a call it waits for, with any args you pass laid over its own, and get the turn back once it has carried on.
denyChatToolCallRefuse a call the assistant waits for. It is told, and carries on without it.

Each person reaches only their own chats, through a client connected with every address. Reading needs threads:read and changing needs threads:write.

The assistant in the app does not have these tools, so a chat never renames or deletes itself.

A turn started here uses only the tools the client was given, and never one that asks for a verification code. A call that changes something waits for approveChatToolCall or denyChatToolCall, as it waits for your answer in the app.

Reference

listChats

Scopesthreads:readMCP only, not in the app's assistantToolkitcore

The conversations held with the assistant in the Nextmail app, as its assistant panel lists them, newest first, each with its title, id and how many messages it holds. query searches the titles. Each person reaches only their own chats. One page at a time: when more follow, the last line gives a cursor to pass back for the next page.

Inputs

querystring
Up to 200 characters
sortstring
One of"newest""oldest""title"
limitinteger
At least 1At most 100
cursorstring
1 to 2048 characters

Also available in

API
GET /chats
TypeScript
chats.list()chats.listAll()chats.iterate()
Python
chats.list()chats.list_all()chats.iterate()
Ruby
chats.listchats.list_allchats.iterate
PHP
chats->listchats->listAllchats->iterate
Go
Chats.ListChats.ListAllChats.Iterate
Java
chats().listchats().listAllchats().iterate
C#
Chats.ListAsyncChats.ListAllAsyncChats.IterateAsync

listChatMessages

Scopesthreads:readMCP only, not in the app's assistantToolkitcore

The messages of one chat with the assistant, from the first unless order is desc: what was said, and each tool the assistant called with its status and arguments. Each person reaches only their own chats. One page at a time: when more follow, the last line gives a cursor to pass back for the next page.

Inputs

chatIdstringRequired

The chat, as listChats names it.

1 to 64 characters
limitinteger
At least 1At most 50
cursorstring
1 to 2048 characters
orderstring

asc reads the chat from its first message, and desc from its newest.

One of"asc""desc"

Also available in

API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny
TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()
Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()
Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call
PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall
Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall
Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall
C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync

sendChatMessage

Scopesthreads:writeMCP only, not in the app's assistantToolkitcore

Say something to the assistant in one of its chats in the Nextmail app, and get the turn back once it has replied: its status, your message and the replies, and each tool call it waits for. A chatId that names no chat yet starts one, and regenerate answers your last message again instead. The assistant answers with the tools the permissions of this client reach. A tool that asks for a verification code is never offered, and a tool that changes something waits for an answer: the turn ends with the status awaiting_approval and lists each call it waits for, and approveChatToolCall or denyChatToolCall answers it. A call you asked for in so many words runs without waiting, as it does in the app. The answer comes back once the turn has ended, so give this call a long timeout. A turn runs for at most 240 seconds. Past that it stops with stopReason time_limit and keeps what it had written. One turn runs in a chat at a time.

Inputs

chatIdstringRequired

The chat, as listChats names it, or a new id of at most 64 characters to start one.

1 to 64 characters
contentstring

What you say to the assistant. Required unless regenerate is true.

1 to 32000 characters
regenerateboolean

Answer your last message again instead of sending a new one. The reply it had is replaced.

messageIdstring

An id for your message, unique in this chat. Left out, one is made up.

1 to 64 characters
attachmentsobject[]

Up to 4 files for the assistant to read: { "fileId": id } for a file in Files, or { "filename", "content", "contentType" } for a text file of at most 256 KiB, its content in base64.

Up to 4 items
fileIdstringRequired
1 to 128 characters
threadIdstring

A conversation the chat is about. It is pinned to the chat with its first message, and the assistant reads it before it answers.

1 to 255 characters
templateIdstring

A template the assistant should work on, as the template editor of the app passes it.

1 to 128 characters

Also available in

API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny
TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()
Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()
Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call
PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall
Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall
Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall
C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync

stopChatTurn

Scopesthreads:writeMCP only, not in the app's assistantToolkitcore

Stop the assistant while it answers in a chat, in the app or through sendChatMessage, keeping what it had written. A tool call that had not returned is marked interrupted. When nothing runs, nothing changes and the answer says so.

Inputs

chatIdstringRequired

The chat, as listChats names it.

1 to 64 characters
turnIdstring

Stops the turn only while it is this one, as turnId of a chat turn names it.

1 to 128 characters

Also available in

API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny
TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()
Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()
Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call
PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall
Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall
Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall
C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync

approveChatToolCall

Scopesthreads:writeMCP only, not in the app's assistantToolkitcore

Let the assistant run a tool call it waits for in a chat, with the arguments the call shows and any args you pass laid over them, and get the turn back once the assistant has carried on. When it waits for several calls, it carries on once every one is answered. Ask the person first: the call does what the assistant asked, such as sending an email. The answer comes back once the turn has ended, so give this call a long timeout. A turn runs for at most 240 seconds. Past that it stops with stopReason time_limit and keeps what it had written. One turn runs in a chat at a time.

Inputs

chatIdstringRequired

The chat, as listChats names it.

1 to 64 characters
toolCallIdstringRequired

The tool call, as the turn that waits for it lists it.

1 to 128 characters
argsRecord<string, any>

Arguments to change before the call runs, laid over the ones the assistant chose. Left out, the call runs as asked.

Also available in

API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny
TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()
Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()
Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call
PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall
Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall
Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall
C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync

denyChatToolCall

Scopesthreads:writeMCP only, not in the app's assistantToolkitcore

Refuse a tool call the assistant waits for in a chat. The assistant is told, and carries on without it once every call it waits for is answered, and the turn comes back as it does from sendChatMessage. The answer comes back once the turn has ended, so give this call a long timeout. A turn runs for at most 240 seconds. Past that it stops with stopReason time_limit and keeps what it had written. One turn runs in a chat at a time.

Inputs

chatIdstringRequired

The chat, as listChats names it.

1 to 64 characters
toolCallIdstringRequired

The tool call, as the turn that waits for it lists it.

1 to 128 characters

Also available in

API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny
TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()
Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()
Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call
PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall
Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall
Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall
C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync