wecom_mcpis an MCP tool; all operations are completed by calling this tool.
⚠️ Prerequisites: before the first call to
wecom_mcp, you must follow thewecom-preflightskill to perform prerequisite checks to ensure the tool has been added to the whitelist.
Interact with the Enterprise WeChat message system via wecom_mcp call msg <接口名> '<json入参>' .
Interface list
get_msg_chat_list — get conversation list
Use the wecom_mcp tool to call wecom_mcp call msg get_msg_chat_list '{"begin_time": "2026-03-11 00:00:00", "end_time": "2026-03-17 23:59:59"}'
Query the list of conversations with messages by time range, supporting pagination. See API details。
get_messages — retrieve conversation messages
Use the wecom_mcp tool to call wecom_mcp call msg get_messages '{"chat_type": 1, "chatid": "zhangsan", "begin_time": "2026-03-17 09:00:00", "end_time": "2026-03-17 18:00:00"}'
Retrieve message records within a specified time range based on conversation type and ID, supporting pagination. Only supports within 7 days. See API details。
send_message — send text message
Use the wecom_mcp tool to call wecom_mcp call msg send_message '{"chat_type": 1, "chatid": "zhangsan", "msgtype": "text", "text": {"content": "hello world"}}'
Send a text message to a one-on-one chat or group chat. See API details。
Core rules
Time range rules
- Format: all time parameters use the
YYYY-MM-DD HH:mm:ssformat - Default range: when the user does not specify, default to the last 7 days (7 days back from the current time)
- Limit: the start time cannot be earlier than 7 days before the current time, and cannot be later than the current time
- Relative time support: supports automatic calculation of "yesterday", "last three days", etc.
chatid lookup rules
- When the user provides a person name or group name instead of an ID:
- Call
get_msg_chat_listto get the conversation list (time range consistent with the target query) - In
chatsmatch bychat_namematch - Matching strategy:
- Exact match with a unique result: use it directly
- Fuzzy match with multiple results: display the candidate list for the user to choose
- No match: tell the user that none was found
- Call
- chat_type determination:
get_msg_chat_listThe return does not include a conversation type field; it must be inferred from context: when the user explicitly mentions "group", usechat_type=2, otherwise default tochat_type=1(one-on-one chat)
userid to username
Process:
- Call
wecom-contact-lookup get_userlistto get the user list - Establish the mapping relationship from userid to username
- Display strategy:
- Exact match: display username
- No match: keep displaying userid
Typical workflow
View conversation list
Example user query:
- "Let me see what chats I have had in the last week"
- "Who has sent me messages these past few days"
Execution process:
- Determine the time range (user-specified or default to the last 7 days)
- Call
get_msg_chat_listto get the conversation list - Display the conversation name, last message time, and message count
- If
has_moreistrue, inform the user that there are more conversations to continue viewing
View chat history
User query example:
- "Help me check the recent chat history with Zhang San"
- "Check the recent messages in the project group"
Execution process:
- Determine the time range (user-specified or default to the last 7 days)
- Through chatid lookup rule determine the target conversation's
chatidandchat_type - Call
get_messagesto retrieve the message list - Call
wecom-contact-lookup'sget_userlistto get the contact list and build a userid→name mapping - When displaying messages, replace
useridwith a readable name, format:姓名 [时间]: 内容 - If
next_cursoris not empty, inform the user that there are more messages to continue viewing
Send message
User query example:
- "Help me send a message to Zhang San: tomorrow's meeting is moved to 3 PM"
- "Send a message in the project group: the meeting is at 3 PM today"
Execution process:
- Through chatid lookup rule determine the target conversation's
chatidandchat_type - Confirm before sending: confirm with the user the recipient and content (e.g.: "About to send to Zhang San: 'tomorrow's meeting is moved to 3 PM', confirm sending?"), and execute after the user confirms
- Call
send_messageto send (msgtypeis fixed totext) - Display the sending result
View messages and reply
User query example:
- "See what Zhang San sent me, then help me reply 'received'"
Execution process:
- First execute the "View chat history" process (reuse the already obtained
chatidandchat_type) - After displaying the messages, execute the "Send message" process (confirmation required before sending)
Error handling
- Time range exceeds limit: inform the user of the 7-day limit and adjust to a valid range
- Conversation not found: clearly inform the user that the corresponding conversation was not found
- API error: display the specific error message, and retry if necessary
- Network issue: proactively retry up to 3 times on HTTP errors`