Skip to main content
Glama

edit-scheduled-message

Modify scheduled messages in Zulip before delivery by updating recipients, content, topic, or timing.

Instructions

Modify a scheduled message before it's sent. For direct messages, use comma-separated email addresses or get user info from the users-directory resource (zulip://users).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scheduled_message_idYesUnique scheduled message ID to edit
typeNoMessage type
toNoRecipients (channel name or comma-separated emails)
contentNoNew message content
topicNoNew topic for stream messages
scheduled_delivery_timestampNoNew delivery timestamp

Implementation Reference

  • The inline async handler function for the 'edit-scheduled-message' tool. It destructures input params, filters undefined values using filterUndefined, validates at least one param, calls zulipClient.editScheduledMessage, and returns formatted success/error responses.
    async ({ scheduled_message_id, type, to, content, topic, scheduled_delivery_timestamp }) => {
      try {
        const updateParams = filterUndefined({
          type,
          to,
          content,
          topic,
          scheduled_delivery_timestamp
        });
        if (Object.keys(updateParams).length === 0) {
          return createErrorResponse('At least one parameter must be provided to update scheduled message');
        }
        await zulipClient.editScheduledMessage(scheduled_message_id, updateParams);
        return createSuccessResponse(`Scheduled message ${scheduled_message_id} updated successfully!`);
      } catch (error) {
        return createErrorResponse(`Error editing scheduled message: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • Zod schema defining and validating the input parameters for the edit-scheduled-message tool, including scheduled_message_id (required) and optional fields for type, to, content, topic, scheduled_delivery_timestamp.
    export const EditScheduledMessageSchema = z.object({
      scheduled_message_id: z.number().describe("Unique scheduled message ID to edit"),
      type: z.enum(["stream", "direct"]).optional().describe("Message type"),
      to: z.string().optional().describe("Recipients (channel name or comma-separated emails)"),
      content: z.string().optional().describe("New message content"),
      topic: z.string().optional().describe("New topic for stream messages"),
      scheduled_delivery_timestamp: z.number().optional().describe("New delivery timestamp")
    });
  • src/server.ts:664-686 (registration)
    Registration of the 'edit-scheduled-message' MCP tool via server.tool(), providing name, description, schema, and handler function.
    server.tool(
      "edit-scheduled-message",
      "Modify a scheduled message before it's sent. For direct messages, use comma-separated email addresses or get user info from the users-directory resource (zulip://users).",
      EditScheduledMessageSchema.shape,
      async ({ scheduled_message_id, type, to, content, topic, scheduled_delivery_timestamp }) => {
        try {
          const updateParams = filterUndefined({
            type,
            to,
            content,
            topic,
            scheduled_delivery_timestamp
          });
          if (Object.keys(updateParams).length === 0) {
            return createErrorResponse('At least one parameter must be provided to update scheduled message');
          }
          await zulipClient.editScheduledMessage(scheduled_message_id, updateParams);
          return createSuccessResponse(`Scheduled message ${scheduled_message_id} updated successfully!`);
        } catch (error) {
          return createErrorResponse(`Error editing scheduled message: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • ZulipClient helper method that implements the core logic for editing a scheduled message by filtering undefined params and making a PATCH request to Zulip's /scheduled_messages/{id} API endpoint.
    async editScheduledMessage(scheduledMessageId: number, params: {
      type?: 'stream' | 'direct';
      to?: string;
      content?: string;
      topic?: string;
      scheduled_delivery_timestamp?: number;
    }): Promise<void> {
      // Filter out undefined values
      const filteredParams = Object.fromEntries(
        Object.entries(params).filter(([, value]) => value !== undefined)
      );
      await this.client.patch(`/scheduled_messages/${scheduledMessageId}`, filteredParams);
    }

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/avisekrath/zulip-mcp-server'

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