send_draft
Sends an existing draft email by its ID, delivering the message to the recipients.
Instructions
Send an existing draft
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the draft to send |
Implementation Reference
- src/index.ts:371-386 (registration)The 'send_draft' tool is registered using server.tool() with name 'send_draft' and description 'Send an existing draft'.
server.tool("send_draft", "Send an existing draft", { id: z.string().describe("The ID of the draft to send") }, async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { try { const { data } = await gmail.users.drafts.send({ userId: 'me', requestBody: { id: params.id } }) return formatResponse(data) } catch (error) { return formatResponse({ error: 'Error sending draft, are you sure you have at least one recipient?' }) } }) } ) - src/index.ts:376-385 (handler)The handler function that executes the send_draft tool logic. It calls gmail.users.drafts.send with the draft ID and returns the response. Wraps the call in a try/catch that returns a user-friendly error message if sending fails (e.g., missing recipients).
async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { try { const { data } = await gmail.users.drafts.send({ userId: 'me', requestBody: { id: params.id } }) return formatResponse(data) } catch (error) { return formatResponse({ error: 'Error sending draft, are you sure you have at least one recipient?' }) } }) } - src/index.ts:373-375 (schema)The input schema for send_draft, which expects a single required string parameter 'id' (the ID of the draft to send).
{ id: z.string().describe("The ID of the draft to send") },