Skip to main content
Glama

send_text_message

Send plain text messages to DingTalk group chats with optional @mentions for specific users or all members.

Instructions

Send a plain text message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe text content to send
atMobilesNoThe mobile numbers of users to @mention (ping) individually in the group chat
atAllNoWhether to @all the users in the group

Implementation Reference

  • Handler function for 'send_text_message' tool that invokes DingtalkBot.sendText and formats MCP response
    async ({ text, atMobiles, atAll }) => { const response = await dingtalkBot.sendText(text, atMobiles, atAll); if (response.errcode !== 0) { return { content: [{ type: "text", text: `Failed to send message, code: ${response.errcode}, message: ${response.errmsg}` }], }; } return { content: [{ type: "text", text: "Message sent successfully" }], }; } );
  • Input schema (zod) for send_text_message tool
    { text: z.string().describe("The text content to send"), atMobiles: z.array(z.string()).optional().describe("The mobile numbers of users to @mention (ping) individually in the group chat"), atAll: z.boolean().optional().describe("Whether to @all the users in the group"), },
  • src/index.ts:22-41 (registration)
    Registration of send_text_message tool using server.tool() including schema and handler
    server.tool( 'send_text_message', 'Send a plain text message', { text: z.string().describe("The text content to send"), atMobiles: z.array(z.string()).optional().describe("The mobile numbers of users to @mention (ping) individually in the group chat"), atAll: z.boolean().optional().describe("Whether to @all the users in the group"), }, async ({ text, atMobiles, atAll }) => { const response = await dingtalkBot.sendText(text, atMobiles, atAll); if (response.errcode !== 0) { return { content: [{ type: "text", text: `Failed to send message, code: ${response.errcode}, message: ${response.errmsg}` }], }; } return { content: [{ type: "text", text: "Message sent successfully" }], }; } );
  • DingtalkBot.sendText method implementing the core logic for sending text messages to DingTalk robot API, called by the tool handler
    async sendText( content: string, atMobiles?: string[], atAll: boolean = false ): Promise<MessageResponse> { const data: TextMessage = { msgtype: 'text', text: { content, }, at: { atMobiles: atMobiles || [], isAtAll: atAll, }, }; const response = await fetch(this.getSignedUrl(), { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(data), }); return response.json() as Promise<MessageResponse>; }
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Shawyeok/mcp-dingding-bot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server