Skip to main content
Glama

send_draft

Send a saved email draft from Gmail by specifying its ID to complete and deliver composed messages.

Instructions

Send an existing draft

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the draft to send

Implementation Reference

  • src/index.ts:371-386 (registration)
    Registers the 'send_draft' MCP tool, including input schema (draft ID) and handler that calls Gmail API to send the 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?' })
          }
        })
      }
    )
  • Inline handler function for 'send_draft' tool that uses handleTool to authenticate and execute gmail.users.drafts.send API call.
    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?' })
        }
      })
    }
  • Zod schema defining input parameters for 'send_draft' tool: requires 'id' as string (draft ID).
    {
      id: z.string().describe("The ID of the draft to send")
    },
  • Shared helper function 'handleTool' used by 'send_draft' (and other tools) to handle OAuth2 authentication, credential validation, Gmail client creation, and API execution with error handling.
    const handleTool = async (queryConfig: Record<string, any> | undefined, apiCall: (gmail: gmail_v1.Gmail) => Promise<any>) => {
      try {
        const oauth2Client = queryConfig ? createOAuth2Client(queryConfig) : defaultOAuth2Client
        if (!oauth2Client) throw new Error('OAuth2 client could not be created, please check your credentials')
    
        const credentialsAreValid = await validateCredentials(oauth2Client)
        if (!credentialsAreValid) throw new Error('OAuth2 credentials are invalid, please re-authenticate')
    
        const gmailClient = queryConfig ? google.gmail({ version: 'v1', auth: oauth2Client }) : defaultGmailClient
        if (!gmailClient) throw new Error('Gmail client could not be created, please check your credentials')
    
        const result = await apiCall(gmailClient)
        return result
      } catch (error: any) {
        // Check for specific authentication errors
        if (
          error.message?.includes("invalid_grant") ||
          error.message?.includes("refresh_token") ||
          error.message?.includes("invalid_client") ||
          error.message?.includes("unauthorized_client") ||
          error.code === 401 ||
          error.code === 403
        ) {
          return formatResponse({
            error: `Authentication failed: ${error.message}. Please re-authenticate by running: npx @shinzolabs/gmail-mcp auth`,
          });
        }
    
        return formatResponse({ error: `Tool execution failed: ${error.message}` });
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Send an existing draft' implies a mutation operation that transmits a draft, but it doesn't describe side effects (e.g., whether the draft is deleted after sending), permissions required, error conditions, or response format. This is inadequate for a mutation tool with zero annotation coverage.

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 with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly without unnecessary elaboration.

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 that this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, return values, error handling, and differentiation from siblings, making it insufficient for an agent to use the tool confidently without additional context.

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?

The input schema has 100% description coverage, with the 'id' parameter fully documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.

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 'Send an existing draft' clearly states the action (send) and resource (draft), with 'existing' distinguishing it from creating a new draft. However, it doesn't explicitly differentiate from sibling tools like 'send_message' or 'create_draft', which would require more specific context about what makes this tool unique.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a draft ID), exclusions, or compare it to similar tools like 'send_message' or 'create_draft', 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/faithk7/gmail-mcp'

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