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')
          },
        ],
      };
    }
Behavior1/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. The description reveals nothing about how the search works (full-text? metadata?), what permissions are required, whether results are paginated, what format they return, or any rate limits. For a search tool with zero annotation coverage, this is completely inadequate.

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 maximally concise at just three words. There's zero wasted language or unnecessary elaboration. While this conciseness comes at the expense of completeness, the description itself is perfectly structured and front-loaded.

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 search tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what kind of search is performed, what fields are searched, what the return format looks like, or any behavioral characteristics. The combination of sparse description and missing structured data leaves significant gaps for an AI agent.

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 description provides no parameter information beyond what's already in the schema. However, with 100% schema description coverage, the schema already documents both parameters ('query' and 'count') adequately. The baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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

Purpose2/5

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

The description 'Search draft emails' is a tautology that essentially restates the tool name. While it does specify the verb 'search' and resource 'draft emails', it lacks specificity about what kind of search is performed (e.g., content-based, metadata-based) and doesn't distinguish it from sibling tools like 'get_draft_emails' or 'search_inbox_emails' beyond the obvious resource difference.

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

Usage Guidelines1/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. There's no mention of when this tool is appropriate versus 'get_draft_emails' (which likely retrieves all drafts without filtering) or 'search_inbox_emails' (which searches a different email folder). No context about prerequisites, limitations, or appropriate use cases is provided.

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

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