Skip to content

ponymail-mcp: search_list renders undefined" for email fields when quick=true #9

@rbowen

Description

@rbowen

Summary

When calling search_list with quick=true, the email rendering loop produces undefined for subject, from, and ID fields. Using emails_only=true instead works correctly.

Steps to Reproduce

  1. Call search_list with parameters:

    • list: dev
    • domain: iceberg.apache.org
    • timespan: lte=7d
    • quick: true
  2. Observe that all email entries render as:

- **undefined**
  From: undefined | Date: 2026-05-15 | ID: undefined
  1. For comparison, call the same endpoint with emails_only=true instead of quick=true — subjects, senders, and IDs are populated correctly.

Expected Behavior

Email fields (subject, from, id/mid) should be populated when rendering the emails section, or the emails section should be skipped entirely when quick=true (since the purpose of quick mode is to return stats only).

Root Cause (Likely)

In index.js, the email rendering code accesses e.subject, e.from, and e.id || e.mid. When PonyMail's /api/stats.lua responds in quick mode, it appears to return email objects with a different structure (or omits those fields entirely), resulting in undefined values.

Suggested Fix

Either:

  1. Skip the emails section when quick=true — since the caller is explicitly requesting stats-only, rendering empty emails is confusing.
  2. Guard the email fields — e.g. e.subject || "(no subject)" and similar fallbacks, and skip rendering entries where all fields are missing.

Option 1 is simplest:

// In the search_list handler, after building stats:
if (!quick && data.emails) {
  // render emails section
}

Environment

Disclaimer: AI-assisted triage using Amazon Quick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions