Skip to content

jmapcli 1.8.1

Choose a tag to compare

@jasonhollis jasonhollis released this 23 Nov 11:05

This release carries both builds. macOS: Homebrew, or jmapcli-1.8.1.tar.gz below; it reports 1.8.1 (core 242258b3). Linux (x86_64 and aarch64): jmapcli-1.8.1-linux-<arch>.tar.gz below (check it against SHA256SUMS, unpack it, and follow README-linux.md inside), or the signed apt and dnf repositories at pkg.boogie.digital; it reports 1.8.1 (core 5ab03684). The program source is the same in both; the Linux build was made from a later commit that corrects the README packed with it.

Added

  • MCP: ten read tools. jmapcli mcp gains ten tools that read, beside the six mail tools: nine that read what the CLI already reads, and vacation.get. Each takes the optional account argument like the mail tools. A bad or missing argument is a JSON-RPC -32602. So is an argument name the tool does not have: a misspelt acount is refused and named, not ignored, and the input schemas say additionalProperties: false. A server without the capability, an unknown id or name, an account that names no configured account, or a server failure is a tool result with isError and a readable message.

    • mailboxes.list — id, name, role, parentId, totalEmails and unreadEmails, in the order jmapcli mailboxes prints.
    • identities.list — the sending identities stored on the server for the selected account: id, name, email, and replyTo when the identity sets one. It sends Identity/get and nothing else, so unlike jmapcli identity list it never creates an identity. When the session does not name urn:ietf:params:jmap:submission, the result is an isError that names it and no Identity/get is sent.
    • contacts.search (query, limit) — every word of the query must be found, ignoring case, in a contact's name, a nickname, an email address, a phone number or an organisation. Returns id, name, emails, phones, organization and isGroup for at most limit contacts (default 20).
    • contacts.get (contact_id) — the fuller card: nicknames, organizations, titles, every email and phone with its contexts, postal addresses, notes, birthday, address-book ids and a group's members. Photos are not returned. It looks in every address book of the login, as contacts.search does, and says "not found" only when every one of them was read: if no book has the card and one could not be read, the result is that failure.
    • calendar.list — id, name, color and isVisible, in the order jmapcli calendar list prints.
    • calendar.events (after, before, calendar) — the events in a window, under the rules of jmapcli calendar events: after and before are local date-times with no zone suffix (yyyy-MM-dd for midnight, or yyyy-MM-ddTHH:mm:ss), read in the machine's time zone; at most 200 events; recurrences are not expanded. calendar limits the list to one calendar by name or id. The result repeats the window and names the zone used. Its limitReached is true when the server returned the full 200: the list may then be cut short, so narrow the window.
    • sieve.list — id, name and isActive. sieve.get (name: a script's name or id) — the same, plus the script text. sieve.validate (script: the text to check) — valid, and error with the server's message when the script is not valid.
    • vacation.get — isEnabled, fromDate, toDate, subject, textBody and htmlBody.

    None of the ten changes a mailbox, an identity, a contact, a calendar, a script or the vacation reply. One does more than read: sieve.validate uploads the text to the server as a blob for the check (it is not stored as a script). The server now reports version 1.3 in initialize.

  • MCP: six tools that write, mail.send behind a switch, and activating a mail filter or replacing a stored script behind another. jmapcli mcp now lists twenty-two tools: the six mail tools, the ten read tools and the six below. Each runs the code of the command it mirrors.

    • mail.draft (to, cc, bcc, reply_to, subject, body, html, plain, from) creates a draft in Drafts, as jmapcli draft does. Every argument is optional.
    • mail.reply_draft (message_id, body, and optionally to, cc, bcc, reply_to, subject, reply_all, plain, from) creates a threaded reply that quotes the original, as jmapcli reply --draft does.
    • mail.forward_draft (message_id, to, and optionally body, cc, bcc, reply_to, subject, plain, from) creates a forward with the original's text and attachments, as jmapcli forward --draft does.
    • None of these three sends anything: each puts one message in Drafts and no EmailSubmission/set is issued, with or without --allow-send. Their result is draftId, sent (false), from, to, cc, bcc, subject and attachments.
    • mail.trash (message_ids) moves messages to the Trash mailbox, as jmapcli trash does: each leaves every other mailbox it is in. An account with no mailbox of the trash role is an isError and nothing moves.
    • calendar.create_event (calendar, title, start, and optionally end or duration, all_day, location, description, timezone) creates one event, as jmapcli calendar event add does. With neither end nor duration the event lasts one hour, or one day with all_day. Without timezone it is in the current time zone of the machine that runs the server, which need not be the user's; the tool's description says so, and the result's timeZone names the zone used. Unlike the command, the tool checks the times first: start and end must be yyyy-MM-ddTHH:mm:ss with no zone suffix (yyyy-MM-dd is enough for start with all_day), end must be later than start, and end cannot be combined with duration or all_day.
    • sieve.push (name, script, activate) stores a Sieve script under a name through the same function as jmapcli sieve push. It asks the server to make the script the active filter only when activate is true; the default is false, as the command's is without --activate. Two things need the server to be started as jmapcli mcp --allow-sieve-activate: activate true, and replacing a script that is already stored. Without the switch the tool is still listed with the same arguments, and with activate false or omitted it still stores a script under a name that no stored script has. A call with activate true and otherwise valid arguments is an isError that names the switch; no account is opened and nothing is uploaded or stored. A call with a name that a stored script already has, active or not, is an isError that names the switch too; the account's list of scripts is read, and nothing is uploaded or stored. Upper and lower case count as different in a name, as they do when the command chooses the script to replace. A script stored without the switch is not made active by the tool; a person can still make it active later. The tool's description in tools/list says which of the two the server does: replace and activate, or refuse both. The switch is separate from --allow-send: neither turns the other on. With the switch, the server writes a line to standard error when it starts saying that sieve.push with activate true is on, and that replacing a stored script is on too. The command jmapcli sieve push needs no switch, with or without --activate. With the switch the tool replaces a stored script of the same name, as the command does, but it refuses a name that is the active script's name unless activate is true, because replacing that script changes the filter that is running: the result is an isError that says so, and nothing is uploaded or stored. With or without the switch, every call that reaches the account reads the account's scripts once, before anything is uploaded, with activate true as well as without; when the scripts cannot be read the call is refused, and nothing is uploaded or stored. The check and the store go by that one reading: the tool does not read the scripts a second time to choose between a new script and a replacement, and the SieveScript/set it sends carries the state of that reading (ifInState) when the server gave one. When a server that honours ifInState finds that the account's scripts changed after the reading, it refuses the store, and the result is an isError that says the scripts changed while the script was being stored, that nothing was stored, and to call sieve.list and try again. So a script that another client stores, renames or makes active between the tool's check and its store is not replaced or changed on such a server. On a server that ignores ifInState, or that gave no state with the reading, the store is sent as it was chosen from the reading, and what another client did in between is not seen: a stored script that the call was to replace is then still replaced when another client has made it the active one in between. Stalwart honours ifInState on SieveScript/set, by one run on a Stalwart test account (23 Nov 2026): with nothing changed in between the script was stored, and when a second jmapcli replaced another script between the reading and the store, the store was refused and the stored script kept its text. The command jmapcli sieve push makes no check first and sends no ifInState. If the script was stored but the scripts cannot be read back afterwards, the result has no activeScript and a warning that says so. Needs JMAPClient with getSieveScriptsWithState and the reading argument of setSieveScript.
    • mail.send (to, subject, body, and optionally cc, bcc, reply_to, html, plain, from) sends a message, as jmapcli send does. It exists only when the server is started as jmapcli mcp --allow-send. Without the switch it is not in tools/list, and a call to it is an isError that names the switch, sends nothing and opens no account. With the switch the server lists twenty-three tools, and when it starts it writes a line to standard error saying that mail.send is on.

    In the composing tools, recipients are one comma-separated string per argument, each entry an address, Name <address>, or the name of an alias or contact, as on the command line. The text is read as Markdown and an HTML part is rendered from it unless plain is true. mail.draft and mail.send also take html, an HTML part that is used as given instead; html together with plain true is refused with -32602 before any account is opened. from must be one of the selected account's sending identities, as identities.list reports them; without it the account's first identity is used. No other account is searched, and the identities are read with Identity/get only. An identity the server returns in a form that cannot be read (one with no address, for example) is skipped by these tools and by identities.list, as the commands skip it. A from the account does not have is an isError that lists what the account can send as. A server that does not name urn:ietf:params:jmap:submission is an isError for all four. These tools take no attachment path and no HTML file path, so they read no file the caller names; a recipient given as a name is still looked up in the local aliases file, as on the command line. vacation.set is not part of this release.

  • jmapcli vacation: the server-side vacation auto-reply. jmapcli vacation shows the current state (--json for the six VacationResponse properties). jmapcli vacation on turns it on, with --from and --to, --subject, --text or --text-file, and --html or --html-file. jmapcli vacation off turns it off and leaves the dates and message on the server. When on or off has made its change, the first line it prints carries the user name the server reports for the account, so it is clear whose reply was changed. on sets the dates exactly as given: with no --from and no --to the reply runs until you turn it off, so an old end date cannot silence it, and a line says so when that removed stored dates. A --to that has already passed is refused. A date such as 2026-12-28 means that whole day in this computer's time zone; a date and time (2026-12-20T09:00) or a full instant (2026-12-20T09:00:00Z) also work. Where the zone database is missing (Linux without tzdata), dates are read and shown in GMT. The subject is kept from last time unless given. The message is kept when no body is given. A text body given alone replaces the whole message and clears a stored HTML body, an HTML body given alone clears a stored text body, and a line says so when something stored was cleared. An empty value ("") clears only the field it names. It needs a server that advertises urn:ietf:params:jmap:vacationresponse (Stalwart does); any other server gets one line saying so. Needs JMAPClient with replaceVacationResponse.

  • vacation on and vacation off look after the mail filter. Where the server offers Sieve, both commands read the Sieve script list before and after they change the reply, and go by what the server did. When a script that was active before vacation on is no longer active after it, a line names that script as suspended, and jmapcli notes its id and name on this computer, per account (in vacation-filter/ in the jmapcli config folder; the note holds the server's API address, the account id and the script's id and name, nothing else). A suspended script without a name gets a warning instead, because jmapcli can only switch a named script back on. vacation off switches a script on only from that note. When no script is active after vacation off, the noted script, if it is still on the server, is sent back with its own text unchanged, under the same name, with activate (the call sieve push --activate makes); once the server reports it active, a line names it as switched back on. When the note says no script was active before vacation on, nothing is switched on. Without a note on this computer nothing is switched on either: when no script is active and the account has Sieve scripts, a warning says that jmapcli has no note and has switched nothing on, lists the scripts by name (marking one that was active until the command turned the reply off) and gives the commands that switch one on, and the exit status is 0. The commands are jmapcli sieve activate <name> and, for when that is refused, jmapcli sieve get <name> > filter.sieve followed by jmapcli sieve push filter.sieve --name <name> --activate. The second way is given for a server that refuses the request sieve activate sends; a Stalwart test account accepted that request (23 Nov 2026). When the noted script cannot be switched back on, the reply stays off, a Warning: line on standard error says why, and vacation off ends with exit status 1: the script is no longer on the server, it has no name, its text could not be read or sent back, the server does not report it active afterwards, or the script list could not be read. The note is kept, so that a second vacation off tries again, unless the script is gone or has no name. When a script other than the noted one is active after vacation off and was already the active one before it, nothing is switched on, the note is kept and a warning says the noted script is not active; the exit status is 0. The note carries no date: vacation off goes by it for as long as it exists. A vacation on that finds the reply off and cannot read the script list removes an older note. A second vacation on, with the reply already on and the server's own script still the active one afterwards, leaves the note as it is. If vacation on cannot read the script list or cannot write the note, the reply change still stands: a Warning: line on standard error says what happened, and the exit status stays 0; the same holds for vacation off when the list cannot be read and no note names a script. A server without Sieve gets no extra call; a server that leaves the active script alone gets the two list reads, and the commands print what they printed before.

  • jmapcli sieve activate <name>: switch a stored script on. Makes the Sieve script that is stored under <name> the account's active filter without sending its text again. The command reads the scripts once, takes the script whose name is exactly <name> (upper and lower case count), and sends one SieveScript/set that carries only the account, that script's id (onSuccessActivateScript) and, when the server gave one, the state of the reading (ifInState); nothing is uploaded, created or updated. Then it reads the scripts back and prints Activated Sieve script '<name>'., the Active filter: line that sieve push prints, and Active before: with the script that was active in the reading, or (none). When no stored script has the name, it says so on standard error, lists the stored scripts by name with the active one marked (or says that none is stored), and ends with exit status 1. When several stored scripts have the name, it refuses, says how many, and ends with exit status 1. When the script is already the active one, it says so, sends nothing more, and ends with exit status 0. When a server that honours ifInState finds that the scripts changed after the reading, it refuses the change; the command says that the scripts changed and that nothing was changed, and ends with exit status 1. A read-back that fails is a warning on standard error, not a failure; the first line then says that the server accepted the request, not that the script is active. If the read-back shows that the script is not the active one although the server reported no error, the command prints the active filter, says that the script is not it, and ends with exit status 1. On a server that ignores ifInState, or that gave no state with the reading, the change is not tied to the reading: what another client did to the scripts in between is not seen, and the request names the script by its id, whatever its name is by then. The command takes --account like the other sieve commands. On a server that does not advertise urn:ietf:params:jmap:sieve it prints the two lines the other sieve commands print and ends with exit status 1. Stalwart accepts a SieveScript/set that only activates, by one run on a Stalwart test account (23 Nov 2026): a stored script was switched on, the script list showed it as the active one, and the script that had been active was switched back on the same way. The same run showed that Stalwart honours ifInState on a store through sieve.push (above); sieve activate against scripts that changed in between was not tried. There is no deactivate command and no MCP tool for this. Needs JMAPClient with getSieveScriptsWithState and activateSieveScript.

Fixed

  • send, draft, reply and forward now act as the account --account names. Before, --account only chose between accounts that both carried the --from address. Without --from, or with a --from the default account also carried, the default account was used and nothing said so: draft --account work@example.com saved the draft in the default account. Now the connection goes to the --account account and --from must be one of its identities (or the account's own name). A --from it does not carry is refused with a message that lists what the account can send as. An --account that names no configured account is refused before anything is contacted. reply and forward read the message they answer from that account, so its id must be one of that account's. Without --account, and with JMAPCLI_ACCOUNT unset, nothing changes.

  • jmapcli mcp: a number too large for an integer no longer ends the server. mail.list or mail.search with a limit, or mail.save_attachment with an index, such as 1e300 stopped the server process. Such a number is now refused with -32602. So is one with a fractional part: "limit": 1.5 was read as 1. A whole number written as 2.0 is still accepted.

  • calendar events help line. It said "(recurrences expanded)", but the query does not ask the server to expand them. It now says "(recurrences not expanded)".

Changed

  • send, draft, reply and forward follow JMAPCLI_ACCOUNT. With --account omitted they now act as the account the variable names, under the same rules as --account: --from must be one of that account's identities, and that refusal says the account came from the variable. A variable that names no configured account is refused before anything is contacted. --account on the command line wins over the variable; with a JMAPCLI_TOKEN or JMAPCLI_PASSWORD override set, a variable and an --account that name different accounts are refused, as before. Before, these four ignored the variable: they went by --from, else the default account. If you export the variable and used --from to switch account for one message (send --from other@example.com), that is now refused: pass --account with that account's address for that message, and keep --from when it is an alias on that account. With a JMAPCLI_TOKEN or JMAPCLI_PASSWORD override set, an --account that differs from the variable is refused, so change JMAPCLI_ACCOUNT instead.

  • move keeps a message's other mailboxes. jmapcli move and the MCP mail.move used to replace a message's whole mailbox list with the target, so a message that was in several mailboxes ended up only in the target. Now each message leaves one mailbox and enters the target, and stays in every other mailbox it is in. A message that is in exactly one mailbox leaves that one. For a message in more than one, name the mailbox to take it out of: jmapcli move <id> <mailbox> --from <mailbox>, or from on mail.move. Without it such a message is refused with a message that lists the mailboxes it is in, and nothing is sent for any message of that command or call. So is a --from mailbox a message is not in, and an id the account has no message for. A message whose source mailbox is the target is left as it is and counted, so repeating a move does no harm. If the server takes the change for some messages and not for others, the result says how many moved and which did not; the command exits with failure and the tool answers isError. A message counts as moved only when the server's reply lists it as updated: a reply that lists none and refuses none means nothing moved, and is that same failure. A move now reads each message's mailboxes with an Email/get before it changes anything. mail.move reports submitted (the distinct ids given), moved, alreadyInMailbox and mailbox. jmapcli trash and mail.trash are unchanged: they still replace the whole list with Trash.

  • sieve push: a read-back that fails is no longer a failed push. After the script is stored, the command reads the scripts back to print Active filter:. When that read failed, the command exited with the error although the script was stored (and active, with --activate). Now it prints the Created or Updated line, writes a warning to standard error that the script was stored and the active filter could not be read back, and exits with success. When the read succeeds the output is what it was.

  • jmapcli mcp: which account a call acts on.

    • The server reads JMAPCLI_ACCOUNT when it starts. A tool call without account acts on the account the variable names, and on the default account only when the variable is unset or empty. An account argument wins over the variable. Before, mcp ignored the variable.
    • An account argument that is an empty string, or not a string, is refused with -32602 by every tool, before any account is opened. Before, an empty string meant the default account, and the six mail tools also read a non-string as the default account.
    • arguments that is present and is not an object (a JSON string, an array, a number) is refused with -32602 by every tool, before any account is opened. Before, it was read as no arguments, so the call lost its account and acted on the variable's or the default account. arguments left out, or JSON null, is still no arguments.
    • The six mail tools now refuse an argument name they do not have with -32602, as the other tools do, and their input schemas say additionalProperties: false. Before, they ignored it, so a misspelt account acted on the default account.
    • Every result of a call that reached an account, a failure included, names the account in a second text content block: {"account":"<the account's configured name, in lower case>"}. The first content block is unchanged. A call refused before its account was resolved names none.