Skip to main content
Glama

mail_extract_bookings

Read-only

Extract exact bookings and appointments from an email's structured data before booking. Get ready-to-use calendar event arguments from schema.org or .ics files.

Instructions

Extract exact bookings and appointments from one email's structured data (schema.org booking markup, .ics attachments), each with calendar_create_event arguments.

Use when: before booking anything from a confirmation or invitation email. Not for booking it (review, then use calendar_create_event) or for answering an invitation (use calendar_respond_to_event). Parameters:

  • folder is where the message lives: an alias (INBOX, Sent, Archive and so on; case-insensitive) or a name copied exactly from mail_list_folders.

  • uid is an integer valid only in that folder, from mail_search_messages, mail_get_thread, mail_list_changes or mail_list_senders (latest_uid).

  • uidvalidity comes from the same result as the uid. Passed, a renumbered folder is refused instead of reading the wrong message, and a message a recent search already saw is fetched without its large non-calendar attachments (PDFs, images). Omitted, the check is skipped and the whole message is fetched. Behavior:

  • read-only; nothing is guessed from the wording.

  • Values are copied from schema.org data (flight, hotel, train, bus, rental car, restaurant, event, boat, taxi) and every event in a calendar or .ics part. Items without a start are dropped.

  • A cancelled booking has kind 'cancellation' and no calendar_event: cancel the existing event instead.

  • Confirm with the owner before booking. Returns: {folder, uid, subject, from, items, found, note}.

  • Up to 20 items (found counts all), each with kind, source, details and calendar_event {summary, start, end, location, description, request_id}.

  • Keep request_id when booking, so a repeat never books twice.

  • Empty items means no structured data: read it with mail_get_message and book only what it states plainly. Errors: 'No message with uid' or 'uids are out of date' (search again), 'Could not open the folder' (check mail_list_folders).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uidYesMessage uid in that folder (from mail_search_messages).
folderYesMail folder, e.g. INBOX, Sent, Archive or a custom name.
uidvalidityNoThe 'uidvalidity' from the result the uid came from: a renumbered folder is then refused, not misread.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "title": "mail_extract_bookingsDictOutput",
      -  "type": "object"
      -}New value: +null
  2. Changed1 schema field changedv0.12.0
    • changedInput schema / properties / uid / description
      Previous value: -"Message uid in that folder (from mail_search)."New value: +"Message uid in that folder (from mail_search_messages)."
  3. Changed10 schema fields changedv0.7.0
    • changedInput schema / properties / folder / description
      Previous value: -"Mail folder: INBOX, or Sent / Drafts / Trash / Junk / Archive, or a custom folder name."New value: +"Mail folder, e.g. INBOX, Sent, Archive or a custom name."
    • removedInput schema / properties / folder / title
      Removed value: -"Folder"
    • changedInput schema / properties / uid / description
      Previous value: -"Message uid inside that folder, taken from mail_search or mail_get_message results."New value: +"Message uid in that folder (from mail_search)."
    • removedInput schema / properties / uid / title
      Removed value: -"Uid"
    • removedInput schema / properties / uidvalidity / anyOf
      Removed value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / uidvalidity / default
      Removed value: -null
    • changedInput schema / properties / uidvalidity / description
      Previous value: -"The folder's 'uidvalidity' from the mail_search / mail_get_message result the uid came from. Pass it back: if the folder was renumbered since, the call is refused instead of acting on the wrong message."New value: +"The 'uidvalidity' from the result the uid came from: a renumbered folder is then refused, not misread."
    • removedInput schema / properties / uidvalidity / title
      Removed value: -"Uidvalidity"
    • addedInput schema / properties / uidvalidity / type
      Added value: +"integer"
    • removedInput schema / title
      Removed value: -"mail_extract_bookingsArguments"
  4. Addedv0.4.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint; the description adds substantial context beyond them: nothing is guessed from wording, items without a start are dropped, cancellations have kind 'cancellation' with no calendar_event, request_id prevents double-booking, and uidvalidity triggers an attachment-skipping optimization. Error strings are also enumerated.

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?

Front-loaded with purpose, then clearly sectioned Parameters/Behavior/Returns/Errors. It is long, but nearly every line carries operational detail (dedup, cancellation, empty-items fallback); a couple of clauses could be tightened without loss.

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

Completeness5/5

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

Despite no output schema, the description fully specifies the return shape ({folder, uid, subject, from, items, found, note}), the 20-item cap, per-item fields, the empty-items fallback to mail_get_message, and the three error conditions. Nothing needed to call it correctly is missing.

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

Parameters4/5

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

Schema coverage is 100% (baseline 3), but the description goes further than the schema: folder aliases are case-insensitive or copied exactly from mail_list_folders, uid is valid only within its folder and lists the tools it comes from, and uidvalidity's refusal/skip behavior is spelled out rather than restated.

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 precise verb+resource ('Extract exact bookings and appointments from one email's structured data') and immediately scopes the sources (schema.org markup, .ics attachments) and output form (calendar_create_event arguments). An agent can distinguish this from calendar_create_event, mail_get_message, and calendar_respond_to_event without opening a schema.

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?

Explicit 'Use when: before booking anything from a confirmation or invitation email' plus two named exclusions routing to calendar_create_event (booking) and calendar_respond_to_event (replying). Both the trigger and the alternatives are stated, leaving nothing to inference.

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