Skip to main content
Glama

edit-message

Modify existing message content or topic in Zulip workspaces by providing the message ID and updated text or subject.

Instructions

Edit an existing message's content or topic.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
message_idYesUnique ID of the message to edit
contentNoNew message content with Markdown formatting
topicNoNew topic name (for stream messages only)

Implementation Reference

  • src/server.ts:497-513 (registration)
    MCP server.tool registration for 'edit-message' tool, including inline handler function that validates parameters and delegates to ZulipClient
    server.tool(
      "edit-message",
      "Edit an existing message's content or topic.",
      EditMessageSchema.shape,
      async ({ message_id, content, topic }) => {
        try {
          const updateParams = filterUndefined({ content, topic });
          if (Object.keys(updateParams).length === 0) {
            return createErrorResponse('At least one of content or topic must be provided for message update');
          }
          await zulipClient.updateMessage(message_id, updateParams);
          return createSuccessResponse(`Message ${message_id} updated successfully!`);
        } catch (error) {
          return createErrorResponse(`Error updating message: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
    );
  • Zod schema defining the input parameters (message_id, optional content, optional topic) for the edit-message tool
    export const EditMessageSchema = z.object({
      message_id: z.number().describe("Unique ID of the message to edit"),
      content: z.string().optional().describe("New message content with Markdown formatting"),
      topic: z.string().optional().describe("New topic name (for stream messages only)")
    });
  • ZulipClient helper method that performs the actual HTTP PATCH request to Zulip's /messages/{id} endpoint to update message content or topic
    async updateMessage(messageId: number, params: {
      content?: string;
      topic?: string;
    }): Promise<void> {
      // Filter out undefined values
      const filteredParams = Object.fromEntries(
        Object.entries(params).filter(([, value]) => value !== undefined)
      );
      await this.client.patch(`/messages/${messageId}`, filteredParams);
    }
  • Utility helper function to remove undefined properties from parameter objects before API calls, used in edit-message handler
    function filterUndefined<T extends Record<string, any>>(obj: T): Partial<T> {
      return Object.fromEntries(
        Object.entries(obj).filter(([_, value]) => value !== undefined)
      ) as Partial<T>;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the action is an edit but doesn't disclose permissions needed, whether edits are reversible, rate limits, or response format. This is inadequate for a mutation tool without annotation support, leaving key behavioral traits unspecified.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('Edit an existing message's content or topic') with zero wasted words. It's appropriately sized for the tool's complexity, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a mutation tool with 3 parameters, the description is incomplete. It lacks behavioral context (e.g., permissions, side effects), usage guidance, and output details, failing to compensate for the missing structured data, which is critical for safe and effective tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are well-documented in the schema. The description adds no additional meaning beyond implying that 'content' and 'topic' are optional (since only 'message_id' is required), but it doesn't clarify parameter interactions or constraints beyond what the schema provides, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Edit') and resource ('an existing message's content or topic'), making the purpose unambiguous. It distinguishes from siblings like 'delete-message' (deletion) and 'send-message' (creation), though it doesn't explicitly contrast with 'edit-draft' or 'edit-scheduled-message' for similar editing functions on different message types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing message_id), exclusions (e.g., not for drafts or scheduled messages), or comparisons to siblings like 'edit-draft' or 'edit-scheduled-message', leaving the agent to infer usage from context alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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