Skip to main content
Glama

search_draft_emails

Find draft emails in Outlook by searching with keywords to locate specific messages before sending.

Instructions

Search draft emails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch keywords
countNoNumber of results to return

Implementation Reference

  • Core implementation of the search_draft_emails tool. Fetches draft emails, uses EmailSummarizer for searching based on query, limits to requested count.
    async searchDraftEmails(query: string, count: number = 10): Promise<EmailMessage[]> { const emails = await this.getDraftEmails(Math.min(count * 2, 50)); const { EmailSummarizer } = await import('./email-summarizer.js'); const searchResults = EmailSummarizer.searchEmails(emails, query); return searchResults.slice(0, count);
  • src/index.ts:199-216 (registration)
    Tool registration including name, description, and input schema definition.
    name: "search_draft_emails", description: "Search draft emails", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search keywords" }, count: { type: "number", description: "Number of results to return", default: 10 } }, required: ["query"] } },
  • Input schema defining parameters: query (required string), count (optional number, default 10).
    inputSchema: { type: "object", properties: { query: { type: "string", description: "Search keywords" }, count: { type: "number", description: "Number of results to return", default: 10 } }, required: ["query"] }
  • MCP tool call dispatcher case that validates input, calls the outlookManager handler, and formats the response.
    case 'search_draft_emails': { const query = (args as any)?.query; const count = (args as any)?.count || 10; if (!query) { throw new Error('Search query is required'); } const drafts = await outlookManager.searchDraftEmails(query, count); return { content: [ { type: 'text', text: `πŸ” **Draft Search Results: "${query}"**\nTotal: ${drafts.length} items\n\nπŸ“‹ **Draft Search Results List:**\n` + drafts.map((draft, index) => `${index + 1}. **${draft.subject}**\n From: ${draft.sender}\n Time: ${draft.receivedTime}\n EntryID: ${draft.id}\n StoreID: ${draft.storeId || 'N/A'}\n Search Context: ${draft.body?.includes(query) ? 'Match in content' : 'Match in subject'}: ${draft.subject}\n Preview: ${draft.body?.substring(0, 100)}...\n` ).join('\n') }, ], }; }

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/cqyefeng119/windows-outlook-mcp'

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