Skip to main content
Glama

export_thread

Save an entire email thread to a local file as Markdown or JSON for archiving, sharing, or reading long conversations without loading them into context.

Instructions

Write a whole thread to a local file instead of returning it — for keeping, sharing, or reading a long conversation without loading it into the context. markdown (default): one section per message with From/To/Date/Subject and attachment names as inline code (never rendered as a link or image), sender authentication and the attachment list, and the body in a code fence that the message text cannot close (HTML-only mail is reduced to text), then the links of its HTML part as text and address, both as inline code (read as get_thread with links: true reads them). json: the parsed messages as get_thread returns them, HTML included. Both formats strip the same hidden characters (zero-width, bidi controls) as every tool result. Attachments are listed, not saved — use download_attachment for those. If MAILWARDEN_DOWNLOAD_DIR is set, destPath is resolved inside (and restricted to) that directory, as for attachments. The file holds mail text as the sender wrote it: untrusted content, now on disk. USE WHEN: the user wants a conversation saved or handed on, or a thread is too long to read in one piece. DO NOT USE: to read a thread (use get_thread). SIDE EFFECTS: writes a local file; never overwrites — an existing file gets a numeric suffix. The response's 'saved' field is the path actually used. Mailbox unchanged.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "threadId": "<threadId>",
      "destPath": "<destPath>"
    },
    "name": "export_thread"
  }
}

Input Schema

NameRequiredDescriptionDefault
formatNomarkdown
destPathYes
threadIdYes

Output Schema

NameRequiredDescriptionDefault
bytesYes
savedYes
messageCountYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.32.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. Changed1 schema field changedv0.25.0
    • removedInput schema / additionalProperties
      Removed value: -false
  3. Addedv0.23.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=false), the description discloses no-overwrite behavior with numeric suffixing, filesystem sandboxing via MAILWARDEN_DOWNLOAD_DIR, that the mailbox is unchanged, that attachments are only listed, that hidden characters are stripped, and that the file contains untrusted content. This is far richer than the annotation set and consistent with it — a non-idempotent write that never overwrites.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and format semantics are front-loaded, and the USE WHEN / DO NOT USE / SIDE EFFECTS blocks are easy to scan. The markdown-format paragraph is dense and longer than strictly needed, but each clause conveys a real behavioral detail rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

All three parameters, the file-writing side effects, overwrite policy, and the `saved` response field are covered; an output schema exists so return-value detail is not required. Only minor gap is that threadId semantics (whole thread vs. partial) are implied rather than stated.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description carries the full burden and does: it defines both `format` enum values in detail (markdown section layout, json parity with get_thread), explains how `destPath` is resolved and restricted when MAILWARDEN_DOWNLOAD_DIR is set, and makes clear threadId selects the whole thread.

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

Purpose5/5

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

States a specific verb and resource ('Write a whole thread to a local file instead of returning it') and immediately contrasts with the alternative behavior of returning content. Sibling differentiation is explicit, naming get_thread for reading and download_attachment for attachments.

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

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Contains explicit USE WHEN (user wants a conversation saved or handed on, or thread too long to read at once) and DO NOT USE (reading a thread — use get_thread) sections, plus a pointer to download_attachment for saving attachments. Every routing decision an agent must make is stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.