Skip to content

Email filtering functionality broken in MCP server #75

@hnizdiljan

Description

@hnizdiljan

Email filtering functionality broken in MCP server

Environment

  • Client: Claude Desktop

Problem Description

The MCP server fails to properly filter emails when using the list-mail-messages tool. Multiple filtering approaches result in various errors, making it impossible to retrieve emails from specific senders.

Steps to Reproduce

  1. Connect Claude Desktop to the MCP server
  2. Request: "Find last 5 e-mails from [email protected]"
  3. Observe the MCP server attempting various filtering methods

Expected Behavior

The server should successfully filter and return the last 5 emails from the specified sender.

Actual Behavior

Multiple failed attempts with different error responses:

Attempt 1 - OData Filter

Request:

{ 
  "top": 5, 
  "filter": "from/emailAddress/address eq '[email protected]'", 
  "select": null, 
  "orderby": null 
}

Response:

Error executing code: Cannot convert undefined or null to object

Attempt 2 - Simplified Filter

Request:

{ 
  "top": 5, 
  "filter": "from/emailAddress/address eq '[email protected]'" 
}

Response:

{"error":"Microsoft Graph API error: 504 Gateway Timeout"}

Attempt 3 - Search Parameter

Request:

{ 
  "top": 5, 
  "search": "from:[email protected]" 
}

Response:

{"error":"Microsoft Graph API error: 400 Bad Request"}

Attempt 4 - Large Result Set

Request:

{ "top": 50 }

Response:

result exceeds maximum length of 1048576

Analysis

The issues suggest multiple problems:

  1. Null/undefined handling: The first error indicates improper handling of null/undefined values in filter parameters
  2. OData filter syntax: The filter syntax may be incorrect for Microsoft Graph API
  3. Search parameter format: The search syntax doesn't match Graph API expectations
  4. Response size limits: Large responses exceed the MCP response size limit
  5. API timeout: Some requests result in gateway timeouts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions