Skip to main content
Glama

zulip_send_direct_message

Send direct messages to specific users in Zulip workspaces by specifying recipient email addresses or user IDs and message content.

Instructions

Send a direct message to one or more users

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipientsYesEmail addresses or user IDs of recipients
contentYesThe message content to send

Implementation Reference

  • Handler logic for the 'zulip_send_direct_message' tool: parses arguments, validates them, calls the ZulipClient's sendDirectMessage method, and returns the response.
    case "zulip_send_direct_message": {
      const args = request.params.arguments as unknown as SendDirectMessageArgs;
      if (!args.recipients || !args.content) {
        throw new Error(
          "Missing required arguments: recipients and content"
        );
      }
      const response = await zulipClient.sendDirectMessage(
        args.recipients,
        args.content
      );
      return {
        content: [{ type: "text", text: JSON.stringify(response) }],
      };
    }
  • Schema definition for the 'zulip_send_direct_message' tool, including input schema, required fields, and description.
    const sendDirectMessageTool: Tool = {
      name: "zulip_send_direct_message",
      description: "Send a direct message to one or more users",
      inputSchema: {
        type: "object",
        properties: {
          recipients: {
            type: "array",
            items: {
              type: "string",
            },
            description: "Email addresses or user IDs of recipients",
          },
          content: {
            type: "string",
            description: "The message content to send",
          },
        },
        required: ["recipients", "content"],
      },
    };
  • index.ts:538-547 (registration)
    Registration of the 'zulip_send_direct_message' tool (as sendDirectMessageTool) in the list of available tools returned by ListToolsRequest.
    tools: [
      listChannelsTool,
      postMessageTool,
      sendDirectMessageTool,
      addReactionTool,
      getChannelHistoryTool,
      getTopicsTool,
      subscribeToChannelTool,
      getUsersTool,
    ],
  • Helper method in ZulipClient class that performs the actual API call to send a direct message via Zulip.
    async sendDirectMessage(recipients: string[], content: string) {
      try {
        const params = {
          to: recipients,
          type: "private",
          content: content,
        };
        
        return await this.client.messages.send(params);
      } catch (error) {
        console.error("Error sending direct message:", error);
        throw error;
      }
    }
  • TypeScript interface defining the arguments for the send direct message tool.
    interface SendDirectMessageArgs {
      recipients: string[];
      content: string;
    }

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/Monadical-SAS/zulip-mcp'

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