get-drafts
Retrieve all saved message drafts in Zulip workspaces using the MCP Server. This tool enables efficient access and management of drafts for streamlined messaging workflows.
Instructions
Retrieve all saved message drafts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:712-734 (handler)MCP tool registration and handler for 'get-drafts': registers the tool with no input params and implements the execution logic by calling ZulipClient.getDrafts(), mapping the response, and returning formatted JSON.server.tool( "get-drafts", "Retrieve all saved message drafts.", {}, async () => { try { const result = await zulipClient.getDrafts(); return createSuccessResponse(JSON.stringify({ draft_count: result.drafts.length, drafts: result.drafts.map(draft => ({ id: draft.id, type: draft.type, to: draft.to, topic: draft.topic, content: draft.content, timestamp: new Date(draft.timestamp * 1000).toISOString() })) }, null, 2)); } catch (error) { return createErrorResponse(`Error getting drafts: ${error instanceof Error ? error.message : 'Unknown error'}`); } } );
- src/zulip/client.ts:316-319 (helper)ZulipClient.getDrafts() helper method: performs HTTP GET to Zulip API '/drafts' endpoint and returns the raw API response.async getDrafts(): Promise<{ drafts: ZulipDraft[] }> { const response = await this.client.get('/drafts'); return response.data; }
- src/types.ts:103-110 (schema)TypeScript interface defining the structure of Zulip draft objects used in the tool's response.export interface ZulipDraft { id: number; type: "stream" | "private"; to: number[]; topic: string; content: string; timestamp: number; }