Skip to main content
Glama

search_inbox_emails

Search your Outlook inbox for emails using keywords to quickly find specific messages and information.

Instructions

Search inbox emails

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch keywords
countNoNumber of results to return

Implementation Reference

  • src/index.ts:132-150 (registration)
    MCP tool registration including name, description, and input schema for search_inbox_emails
    {
      name: "search_inbox_emails",
      description: "Search inbox emails",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search keywords"
          },
          count: {
            type: "number",
            description: "Number of results to return",
            default: 10
          }
        },
        required: ["query"]
      }
    },
  • Primary MCP tool handler for search_inbox_emails: extracts parameters, calls OutlookManager.searchInboxEmails, formats and returns search results
    case 'search_inbox_emails': {
      const query = (args as any)?.query;
      const count = (args as any)?.count || 10;
      if (!query) {
        throw new Error('Search query is required');
      }
      const emails = await outlookManager.searchInboxEmails(query, count);
      return {
        content: [
          {
            type: 'text',
            text: `🔍 **Search Results: "${query}"**\nTotal: ${emails.length} items\nUnread: ${emails.filter(e => !e.isRead).length} items\n\n📋 **Search Results List:**\n` +
                 emails.map((email, index) => 
                   `${index + 1}. ${email.isRead ? 'âś…' : 'đź“©'} **${email.subject}**\n   From: ${email.sender}\n   Time: ${email.receivedTime}\n   EntryID: ${email.id}\n   StoreID: ${email.storeId || 'N/A'}\n   Search Context: ${email.body?.includes(query) ? 'Match in content' : 'Match in subject'}: ${email.subject}\n   Preview: ${email.body?.substring(0, 100)}...\n`
                 ).join('\n')
          },
        ],
      };
    }
  • Core implementation: fetches more inbox emails than requested, uses EmailSummarizer to filter by query, returns top count results
    async searchInboxEmails(query: string, count: number = 10): Promise<EmailMessage[]> {
      const emails = await this.getInboxEmails(Math.min(count * 2, 50));
      const { EmailSummarizer } = await import('./email-summarizer.js');
      const searchResults = EmailSummarizer.searchEmails(emails, query);
      return searchResults.slice(0, count);
    }
  • Helper function that performs the actual text search across subject, sender, and body content of emails
    static searchEmails(emails: EmailMessage[], searchTerm: string): EmailMessage[] {
      if (!searchTerm.trim()) {
        return emails;
      }
    
      const normalizedSearchTerm = searchTerm.toLowerCase();
      
      return emails.filter(email => {
        // Search in subject
        const subjectMatch = email.subject.toLowerCase().includes(normalizedSearchTerm);
        
        // Search in sender
        const senderMatch = email.sender.toLowerCase().includes(normalizedSearchTerm);
        
        // Search in body content (remove HTML tags before searching)
        const cleanBody = email.body.replace(/<[^>]*>/g, '').toLowerCase();
        const bodyMatch = cleanBody.includes(normalizedSearchTerm);
        
        return subjectMatch || senderMatch || bodyMatch;
      });
    }
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 only states the basic action without revealing any behavioral traits such as whether this is a read-only operation, what permissions are required, how results are returned (e.g., format, pagination), or any rate limits. This leaves critical operational details unspecified for a search tool.

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 extremely concise with just three words, front-loading the core action and resource. There is no wasted language or unnecessary elaboration, making it efficient for quick understanding. However, this conciseness comes at the cost of completeness, as noted in other dimensions.

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 the tool's complexity (a search operation with 2 parameters), lack of annotations, and no output schema, the description is incomplete. It fails to address key contextual elements like what the search covers (e.g., subject, body, sender), how results are structured, or error conditions. While the schema covers parameters, the overall context for effective tool use is insufficient.

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 clear documentation for both parameters (query and count). The description adds no additional meaning beyond what the schema provides—it doesn't explain parameter interactions, search syntax, or result limitations. With high schema coverage, the baseline score of 3 is appropriate as the schema handles parameter documentation adequately.

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 inbox emails' is a tautology that essentially restates the tool name. While it indicates the resource (inbox emails) and action (search), it lacks specificity about what distinguishes this tool from sibling search tools like search_draft_emails or search_sent_emails. The purpose is clear at a basic level but fails to differentiate from alternatives.

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. It doesn't mention when this tool is appropriate (e.g., for searching received emails) versus when to use sibling tools like search_draft_emails or search_sent_emails. There's no indication of prerequisites, context, or exclusions, leaving the agent with no usage direction.

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