@littlebearapps/outlook-assistant 3.7.2 → 3.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,6 +14,7 @@
14
14
  <a href="https://github.com/littlebearapps/outlook-assistant/actions/workflows/ci.yml"><img src="https://github.com/littlebearapps/outlook-assistant/actions/workflows/ci.yml/badge.svg" alt="CI" /></a>
15
15
  <a href="https://github.com/littlebearapps/outlook-assistant/actions/workflows/codeql.yml"><img src="https://github.com/littlebearapps/outlook-assistant/actions/workflows/codeql.yml/badge.svg" alt="CodeQL" /></a>
16
16
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
17
+ <a href="https://glama.ai/mcp/servers/littlebearapps/outlook-assistant"><img src="https://glama.ai/mcp/servers/littlebearapps/outlook-assistant/badges/score.svg" alt="Glama score" /></a>
17
18
  </p>
18
19
 
19
20
  Outlook Assistant connects AI assistants to your Microsoft Outlook account through the [Model Context Protocol](https://modelcontextprotocol.io/). Ask your AI assistant to search your inbox, send emails, schedule meetings, manage contacts, and configure mailbox settings — without leaving the conversation. Works with Claude, Cursor, Windsurf, and any MCP-compatible client.
@@ -36,8 +37,8 @@ Outlook Assistant connects AI assistants to your Microsoft Outlook account throu
36
37
  - 🛡️ **Send emails with safety controls** — dry-run preview, pre-send mail tips (out-of-office, mailbox full, delivery restrictions), session rate limiting, and recipient allowlist to prevent mistakes
37
38
  - ✏️ **Draft emails for review** — create, update, and send drafts; reply and forward as drafts; preview before saving with dry-run mode
38
39
  - 📅 **Manage your calendar** — view upcoming events, schedule meetings with attendees, decline or cancel invitations
39
- - 📦 **Export emails** — save to Markdown, EML, MBOX, JSON, or HTML for archiving, analysis, or migration; export search results or entire threads in one call
40
- - 🔍 **Investigate email headers** — check DKIM, SPF, and DMARC authentication; trace delivery chains; analyse spam scores — useful for phishing investigation and compliance
40
+ - 📦 **Export emails** — save individual messages to Markdown, EML, JSON, or CSV; export full conversation threads to MBOX or HTML; bulk-export search results in one call
41
+ - 🔍 **Investigate email headers** — full raw header access (DKIM, SPF, DMARC, delivery chain, X-Mailer, X-Originating-IP) for phishing investigation and compliance review
41
42
  - 🗂️ **Organise your inbox** — create folders, set up inbox rules, colour-code with categories, manage Focused Inbox — all work together for complete inbox automation
42
43
  - 🔄 **Track inbox changes** — delta sync detects new, modified, and deleted emails since your last check, with tokens for incremental polling
43
44
  - 👥 **Manage contacts** — search your contact book and organisational directory, create and update contact records
@@ -75,16 +76,18 @@ Outlook Assistant connects AI assistants to your Microsoft Outlook account throu
75
76
 
76
77
  ### Export Formats
77
78
 
78
- | Format | Extension | When to Use It |
79
- |--------|-----------|----------------|
80
- | `mime` / `eml` | `.eml` | Legal holds, forensic preservation, importing into other mail clients |
81
- | `mbox` | `.mbox` | Archiving entire conversation threads, migrating between systems |
82
- | `markdown` | `.md` | Pasting into documents, feeding into AI workflows |
83
- | `json` | `.json` | Data analysis, pipeline processing, compliance reporting |
84
- | `html` | `.html` | Visual archival with formatting intact |
85
- | `csv` | `.csv` | Spreadsheet import, bulk metadata analysis, compliance audits |
79
+ Format support varies by `target`:
86
80
 
87
- Export individual emails, search results, or entire conversation threads — use `target=messages` with a search query to batch-export without manually collecting IDs.
81
+ | Format | Extension | `target=message` (single) | `target=messages` (batch) | `target=conversation` (thread) |
82
+ |--------|-----------|--------|--------|--------|
83
+ | `mime` / `eml` | `.eml` | ✅ | – | ✅ |
84
+ | `mbox` | `.mbox` | – | – | ✅ |
85
+ | `markdown` | `.md` | ✅ | ✅ | ✅ |
86
+ | `json` | `.json` | ✅ | ✅ | ✅ |
87
+ | `html` | `.html` | – | – | ✅ |
88
+ | `csv` | `.csv` | ✅ | ✅ | ✅ |
89
+
90
+ Export individual emails, search results, or entire conversation threads — use `target=messages` with a search query (or the `query` shortcut) to batch-export without manually collecting IDs.
88
91
 
89
92
  ## Account Compatibility
90
93
 
@@ -100,7 +103,7 @@ Outlook Assistant works with both personal and work/school Microsoft accounts, b
100
103
  | Free-text `query` search | Limited — use `subject`, `from`, `to` filters instead | Full KQL support |
101
104
  | Categories | Full support | Full support |
102
105
  | Mailbox settings | Full support | Full support |
103
- | Focused Inbox | Not available | Full support |
106
+ | Focused Inbox | API works (overrides stored) but mail routing not affected | Full support |
104
107
  | Shared mailboxes | Not available | Requires `Mail.Read.Shared` |
105
108
  | Meeting room search | Not available | Requires `Place.Read.All` + admin consent |
106
109
 
@@ -109,7 +112,7 @@ Outlook Assistant works with both personal and work/school Microsoft accounts, b
109
112
  ### What Makes This Different
110
113
 
111
114
  - **Progressive search** — on accounts where Microsoft's `$search` API is limited, Outlook Assistant automatically falls back through up to 4 search strategies to find your emails. Most Graph API wrappers fail silently; this one adapts.
112
- - **Email forensics** — full header analysis (DKIM, SPF, DMARC, delivery chain, spam scores) built in as a first-class feature — useful for phishing investigation, compliance, and security review.
115
+ - **Email forensics** — raw header access for DKIM, SPF, DMARC, delivery chain, X-Mailer, X-Originating-IP, and spam scores. Returns the full data so you can investigate phishing, audit compliance, or trace delivery issues. (Auto-verdict is on the v3.8.0 roadmap; today the data is surfaced and analysed in-conversation.)
113
116
  - **Delta sync** — incremental inbox monitoring returns only what changed since your last check, with tokens for continuous polling. Designed for agent workflows that need to watch a mailbox.
114
117
  - **Batch operations** — flag, move, export, or categorise multiple emails in a single call. Search-driven export lets you batch-export results without collecting IDs manually.
115
118
  - **Pre-send intelligence** — check recipients for out-of-office, full mailbox, delivery restrictions, and moderation status before sending — no other Outlook MCP server offers this.
@@ -127,6 +130,17 @@ Outlook Assistant is designed with safety-first principles for AI-driven email a
127
130
  - **Session rate limiting** — configurable via `OUTLOOK_MAX_EMAILS_PER_SESSION` (default: unlimited)
128
131
  - **Recipient allowlist** — restrict sending to approved addresses/domains via `OUTLOOK_ALLOWED_RECIPIENTS`
129
132
 
133
+ > **Recommended setup**: enable both safety belts in your `.mcp.json` from day one. They're off by default; `auth action=about` reports their state and prints a setup hint when unset. See [`.mcp.json.example`](.mcp.json.example) for a copy-paste template.
134
+ >
135
+ > ```json
136
+ > "env": {
137
+ > "OUTLOOK_CLIENT_ID": "…",
138
+ > "OUTLOOK_CLIENT_SECRET": "…",
139
+ > "OUTLOOK_MAX_EMAILS_PER_SESSION": "10",
140
+ > "OUTLOOK_ALLOWED_RECIPIENTS": "your-domain.com,trusted@example.com"
141
+ > }
142
+ > ```
143
+
130
144
  **Draft protections** — The `draft` tool shares `send-email` safety controls: dry-run preview, recipient allowlist, mail-tips validation, and rate limiting. The `send` action shares the `send-email` rate limit counter, preventing circumvention via the draft-then-send pathway.
131
145
 
132
146
  **Token-optimised architecture** — Tools are consolidated using the STRAP (Single Tool, Resource, Action Pattern) approach. 22 tools instead of 55 reduces per-turn overhead by ~11,000 tokens (~64%), keeping more of the AI's context window available for your actual conversation. Fewer tools also means the AI selects the right tool more accurately — research shows tool selection degrades beyond ~40 tools.
@@ -356,6 +370,8 @@ No auth server needed. Works everywhere, including remote/headless environments.
356
370
  5. Tokens are saved to `~/.outlook-assistant-tokens.json` and **refresh automatically**
357
371
 
358
372
  > **Prerequisite**: Enable "Allow public client flows" in Azure Portal > your app > Authentication > Advanced settings.
373
+ >
374
+ > **Server restarts** (v3.7.2+): Device code state is persisted to `~/.outlook-assistant-pending-auth.json`, so `device-code-complete` works even if the MCP server restarts between steps 1 and 4 (e.g., Untether/Telegram bridge, Claude Desktop session changes).
359
375
 
360
376
  ### Browser Redirect Flow (Alternative)
361
377
 
@@ -431,6 +447,10 @@ If using browser flow: start the auth server first with `npm run auth-server`. I
431
447
 
432
448
  Enable "Allow public client flows" in Azure Portal > App registrations > Authentication > Advanced settings.
433
449
 
450
+ ### Token refresh fails after ~60 minutes (device code auth)
451
+
452
+ Fixed in v3.7.2. Earlier versions sent `client_secret` in token refresh requests for device-code auth, which Microsoft rejects for public client flows. Update to v3.7.2+ or re-authenticate.
453
+
434
454
  ### Empty API responses
435
455
 
436
456
  Check authentication status with the `auth` tool (action=status). Tokens may have expired — re-authenticate if needed.
@@ -467,7 +487,8 @@ USE_TEST_MODE=true npm start
467
487
  |-------|-------------|
468
488
  | [Getting Started](docs/how-to/getting-started/connect-outlook-to-claude.md) | Install, configure, and authenticate — start here |
469
489
  | [Azure Setup Guide](docs/guides/azure-setup.md) | Azure account creation, app registration, permissions, and secrets |
470
- | [How-To Guides](docs/how-to/index.md) | 28 practical guides for email, calendar, contacts, and settings |
490
+ | [How-To Guides](docs/how-to/index.md) | 29 practical guides for email, calendar, contacts, and settings |
491
+ | [Roadmap](ROADMAP.md) | Active milestones (v3.7.5, v3.8.0, v3.9.0) and recent releases |
471
492
  | [Troubleshooting & FAQ](docs/how-to/getting-started/verify-your-connection.md#common-connection-problems) | Common problems, re-authentication, and frequently asked questions |
472
493
  | [Tools Reference](docs/quickrefs/tools-reference.md) | All 22 tools with parameters |
473
494
  | [AI Agent Guide](docs/how-to/ai-agents/using-outlook-assistant-in-agents.md) | Tool selection and workflow patterns for AI agents |
@@ -494,10 +515,6 @@ For security concerns, please see our [Security Policy](SECURITY.md). Do not ope
494
515
 
495
516
  See [CHANGELOG.md](CHANGELOG.md) for version history.
496
517
 
497
- ## Listed On
498
-
499
- <a href="https://glama.ai/mcp/servers/littlebearapps/outlook-assistant"><img width="190" height="100" src="https://glama.ai/mcp/servers/littlebearapps/outlook-assistant/badge" alt="Outlook Assistant on Glama" /></a>
500
-
501
518
  ## About
502
519
 
503
520
  Built and maintained by [Little Bear Apps](https://littlebearapps.com). Outlook Assistant is open source under the [MIT License](LICENSE).
package/advanced/index.js CHANGED
@@ -46,7 +46,10 @@ function formatEmail(email, verbosity = 'standard') {
46
46
  * Requires Mail.Read.Shared permission
47
47
  */
48
48
  async function handleAccessSharedMailbox(args) {
49
- const { sharedMailbox, folder, count, outputVerbosity } = args;
49
+ // F-46: accept `email` as alias for `sharedMailbox`. The original
50
+ // param name is awkward; most callers reach for `email` first.
51
+ const { folder, count, outputVerbosity } = args;
52
+ const sharedMailbox = args.sharedMailbox || args.email;
50
53
 
51
54
  if (!sharedMailbox) {
52
55
  return {
@@ -458,11 +461,24 @@ async function handleFindMeetingRooms(args) {
458
461
  );
459
462
  rooms = roomsResponse.value || [];
460
463
  } catch (findRoomsError) {
464
+ // F-47: distinguish "feature not available on personal account"
465
+ // from generic permission errors. Personal Outlook.com accounts
466
+ // surface a 404 here; organizational accounts surface
467
+ // permission errors. Both look similar in Graph but mean very
468
+ // different things to the caller.
469
+ const errMsg = findRoomsError.message || '';
470
+ const isLikelyPersonal =
471
+ errMsg.includes('404') ||
472
+ errMsg.includes('Not Found') ||
473
+ errMsg.includes('NotFound');
474
+ const explanation = isLikelyPersonal
475
+ ? 'Meeting room search is M365-only. Personal Outlook.com accounts cannot use this feature — there are no rooms to find. Connect a Microsoft 365 work/school account to enable.'
476
+ : 'This feature requires:\n- Places.Read.All permission\n- Meeting rooms configured in your organization';
461
477
  return {
462
478
  content: [
463
479
  {
464
480
  type: 'text',
465
- text: `Unable to find meeting rooms.\n\n**Note**: This feature requires:\n- Places.Read.All permission\n- Meeting rooms configured in your organization\n\nError: ${findRoomsError.message}`,
481
+ text: `Unable to find meeting rooms.\n\n**Note**: ${explanation}\n\nError: ${errMsg}`,
466
482
  },
467
483
  ],
468
484
  };
@@ -603,6 +619,11 @@ const advancedTools = [
603
619
  type: 'string',
604
620
  description: 'Email address of the shared mailbox (required)',
605
621
  },
622
+ email: {
623
+ type: 'string',
624
+ description:
625
+ 'Alias for `sharedMailbox` (more intuitive name for the same value).',
626
+ },
606
627
  folder: {
607
628
  type: 'string',
608
629
  description: 'Folder to read from (default: inbox)',
@@ -617,7 +638,8 @@ const advancedTools = [
617
638
  description: 'Output detail level (default: standard)',
618
639
  },
619
640
  },
620
- required: ['sharedMailbox'],
641
+ additionalProperties: false,
642
+ required: [],
621
643
  },
622
644
  handler: handleAccessSharedMailbox,
623
645
  },
@@ -654,6 +676,7 @@ const advancedTools = [
654
676
  description: 'Output detail level (default: standard)',
655
677
  },
656
678
  },
679
+ additionalProperties: false,
657
680
  required: [],
658
681
  },
659
682
  handler: handleFindMeetingRooms,
package/auth/tools.js CHANGED
@@ -28,17 +28,40 @@ async function handleAbout() {
28
28
  (s) => s !== 'offline_access'
29
29
  );
30
30
  const testMode = config.USE_TEST_MODE ? 'Enabled' : 'Disabled';
31
+ const rateLimitConfigured = Boolean(
32
+ process.env.OUTLOOK_MAX_EMAILS_PER_SESSION
33
+ );
34
+ const allowlistConfigured = Boolean(process.env.OUTLOOK_ALLOWED_RECIPIENTS);
31
35
  const rateLimit =
32
36
  process.env.OUTLOOK_MAX_EMAILS_PER_SESSION || 'Unlimited (no limit set)';
33
37
  const allowlist =
34
38
  process.env.OUTLOOK_ALLOWED_RECIPIENTS || 'None (all recipients allowed)';
35
39
 
40
+ // F-2: surface the authenticated user's email so callers and AI
41
+ // agents can confirm which mailbox is connected. Uses a single
42
+ // GET /me round-trip when a valid token is available; degrades
43
+ // gracefully when not authenticated.
44
+ let identity = 'Not authenticated (run `auth action=authenticate`)';
45
+ try {
46
+ const { ensureAuthenticated } = require('./index');
47
+ const { callGraphAPI } = require('../utils/graph-api');
48
+ const token = await ensureAuthenticated();
49
+ const me = await callGraphAPI(token, 'GET', 'me', null, {
50
+ $select: 'userPrincipalName,mail,displayName',
51
+ });
52
+ const upn = me.mail || me.userPrincipalName;
53
+ identity = me.displayName ? `${me.displayName} <${upn}>` : upn;
54
+ } catch (_e) {
55
+ // Leave default identity message in place
56
+ }
57
+
36
58
  const lines = [
37
59
  `# Outlook Assistant Server v${config.SERVER_VERSION}\n`,
38
60
  `Provides access to Microsoft Outlook email, calendar, and contacts through Microsoft Graph API.\n`,
39
61
  `## Diagnostics\n`,
40
62
  `| Setting | Value |`,
41
63
  `|---------|-------|`,
64
+ `| Mailbox | ${identity} |`,
42
65
  `| Tools | ${_toolCount} across 9 modules |`,
43
66
  `| Modules | auth, email, calendar, folder, rules, contacts, categories, settings, advanced |`,
44
67
  `| Timezone | ${config.DEFAULT_TIMEZONE} |`,
@@ -50,6 +73,27 @@ async function handleAbout() {
50
73
  `**Scopes**: ${scopes.join(', ')}`,
51
74
  ];
52
75
 
76
+ // F-1 / F-48: warn when no safety belts are wired up. AI-assisted
77
+ // sending is significantly safer with a session rate limit and a
78
+ // recipient allowlist; both are off by default.
79
+ if (!rateLimitConfigured || !allowlistConfigured) {
80
+ lines.push('');
81
+ lines.push('## ⚠ Safety Belts Not Configured\n');
82
+ lines.push(
83
+ 'No rate limit or recipient allowlist is set. For safer AI-assisted sending, add to your `.mcp.json` env block:'
84
+ );
85
+ lines.push('```');
86
+ if (!rateLimitConfigured) {
87
+ lines.push('OUTLOOK_MAX_EMAILS_PER_SESSION=10');
88
+ }
89
+ if (!allowlistConfigured) {
90
+ lines.push(
91
+ 'OUTLOOK_ALLOWED_RECIPIENTS=your-domain.com,trusted@example.com'
92
+ );
93
+ }
94
+ lines.push('```');
95
+ }
96
+
53
97
  return {
54
98
  content: [
55
99
  {
@@ -369,6 +413,7 @@ const authTools = [
369
413
  'Force re-authentication even if already authenticated (action=authenticate only)',
370
414
  },
371
415
  },
416
+ additionalProperties: false,
372
417
  required: [],
373
418
  },
374
419
  handler: async (args) => {
@@ -381,8 +426,16 @@ const authTools = [
381
426
  case 'about':
382
427
  return handleAbout();
383
428
  case 'status':
384
- default:
385
429
  return handleCheckAuthStatus();
430
+ default:
431
+ return {
432
+ content: [
433
+ {
434
+ type: 'text',
435
+ text: `Unknown action '${action}'. Valid actions: status, authenticate, device-code-complete, about.`,
436
+ },
437
+ ],
438
+ };
386
439
  }
387
440
  },
388
441
  },
package/calendar/index.js CHANGED
@@ -25,6 +25,7 @@ const calendarTools = [
25
25
  description: 'Number of events to retrieve (default: 10, max: 50)',
26
26
  },
27
27
  },
28
+ additionalProperties: false,
28
29
  required: [],
29
30
  },
30
31
  handler: handleListEvents,
@@ -65,6 +66,7 @@ const calendarTools = [
65
66
  description: 'Optional body content for the event',
66
67
  },
67
68
  },
69
+ additionalProperties: false,
68
70
  required: ['subject', 'start', 'end'],
69
71
  },
70
72
  handler: handleCreateEvent,
@@ -91,14 +93,38 @@ const calendarTools = [
91
93
  type: 'string',
92
94
  description: 'The ID of the event',
93
95
  },
96
+ id: {
97
+ type: 'string',
98
+ description:
99
+ 'Alias for `eventId` (canonical per the v3.7.3 alias pass).',
100
+ },
94
101
  comment: {
95
102
  type: 'string',
96
103
  description: 'Optional comment for declining or cancelling the event',
97
104
  },
98
105
  },
99
- required: ['action', 'eventId'],
106
+ additionalProperties: false,
107
+ required: ['action'],
100
108
  },
101
109
  handler: async (args) => {
110
+ // F-37: accept `id` as alias for `eventId` so callers don't have
111
+ // to remember which tool uses which name. Both work; eventId
112
+ // remains the canonical Graph param.
113
+ const normalised = { ...args };
114
+ if (!normalised.eventId && normalised.id) {
115
+ normalised.eventId = normalised.id;
116
+ }
117
+ if (!normalised.eventId) {
118
+ return {
119
+ content: [
120
+ {
121
+ type: 'text',
122
+ text: 'Required parameter `eventId` (or alias `id`) is missing.',
123
+ },
124
+ ],
125
+ };
126
+ }
127
+ args = normalised;
102
128
  switch (args.action) {
103
129
  case 'decline':
104
130
  return handleDeclineEvent(args);
@@ -116,9 +116,9 @@ async function handleListCategories(args) {
116
116
  output.push('|----------|-------|-----|');
117
117
  categories.forEach((cat) => {
118
118
  const colorName = COLOR_NAMES[cat.color] || cat.color;
119
- const idDisplay =
120
- outputVerbosity === 'full' ? cat.id : `${cat.id.substring(0, 8)}...`;
121
- output.push(`| ${cat.displayName} | ${colorName} | ${idDisplay} |`);
119
+ // F-9: emit full IDs at standard verbosity. Truncated IDs were
120
+ // unusable downstream (the ellipsis became part of the copy).
121
+ output.push(`| ${cat.displayName} | ${colorName} | ${cat.id} |`);
122
122
  });
123
123
  }
124
124
 
@@ -255,7 +255,9 @@ async function handleCreateCategory(args) {
255
255
  * Update category handler
256
256
  */
257
257
  async function handleUpdateCategory(args) {
258
- const { id, displayName, color } = args;
258
+ // F-34: accept `categoryId` as a deprecated alias for `id`.
259
+ const id = args.id || args.categoryId;
260
+ const { displayName, color } = args;
259
261
 
260
262
  if (!id) {
261
263
  return {
@@ -298,34 +300,45 @@ async function handleUpdateCategory(args) {
298
300
  if (displayName) updateData.displayName = displayName;
299
301
  if (color) updateData.color = color;
300
302
 
301
- const response = await callGraphAPI(
303
+ await callGraphAPI(
302
304
  accessToken,
303
305
  'PATCH',
304
306
  `me/outlook/masterCategories/${id}`,
305
307
  updateData
306
308
  );
307
309
 
308
- // Prefer input values over response (PATCH may return partial data)
309
- const updatedName = displayName || response.displayName;
310
- const updatedColor = color || response.color;
311
- const colorName = COLOR_NAMES[updatedColor] || updatedColor;
310
+ // F-35: Graph silently drops master-category color updates on
311
+ // some account types. Re-fetch the category and diff requested
312
+ // values against what Graph actually stored, so the caller
313
+ // doesn't get a misleading "Category updated!" when nothing
314
+ // changed.
315
+ const fresh = await callGraphAPI(
316
+ accessToken,
317
+ 'GET',
318
+ `me/outlook/masterCategories/${id}`
319
+ );
312
320
 
313
- const updatedCategory = {
314
- ...response,
315
- displayName: updatedName,
316
- color: updatedColor,
317
- };
321
+ const warnings = [];
322
+ if (color && fresh.color !== color) {
323
+ warnings.push(
324
+ `Requested color \`${color}\` but Graph stored \`${fresh.color}\` (master-category colors may be immutable on this account type).`
325
+ );
326
+ }
327
+ if (displayName && fresh.displayName !== displayName) {
328
+ warnings.push(
329
+ `Requested name \`${displayName}\` but Graph stored \`${fresh.displayName}\`.`
330
+ );
331
+ }
332
+
333
+ const colorName = COLOR_NAMES[fresh.color] || fresh.color;
334
+ let text = `Category updated!\n\n**Name**: ${fresh.displayName}\n**Color**: ${colorName} (${fresh.color})\n**ID**: ${fresh.id || id}`;
335
+ if (warnings.length > 0) {
336
+ text += `\n\n**⚠ Warning**:\n${warnings.map((w) => `- ${w}`).join('\n')}`;
337
+ }
318
338
 
319
339
  return {
320
- content: [
321
- {
322
- type: 'text',
323
- text: `Category updated!\n\n**Name**: ${updatedName}\n**Color**: ${colorName} (${updatedColor})\n**ID**: ${response.id || id}`,
324
- },
325
- ],
326
- _meta: {
327
- category: formatCategory(updatedCategory),
328
- },
340
+ content: [{ type: 'text', text }],
341
+ _meta: { category: formatCategory(fresh) },
329
342
  };
330
343
  } catch (error) {
331
344
  if (error.message === 'Authentication required') {
@@ -353,7 +366,8 @@ async function handleUpdateCategory(args) {
353
366
  * Delete category handler
354
367
  */
355
368
  async function handleDeleteCategory(args) {
356
- const { id } = args;
369
+ // F-34: accept `categoryId` as a deprecated alias for `id`.
370
+ const id = args.id || args.categoryId;
357
371
 
358
372
  if (!id) {
359
373
  return {
@@ -824,8 +838,9 @@ const categoriesTools = [
824
838
  properties: {
825
839
  action: {
826
840
  type: 'string',
827
- enum: ['list', 'create', 'update', 'delete'],
828
- description: 'Action to perform (default: list)',
841
+ enum: ['list', 'create', 'update', 'set', 'delete'],
842
+ description:
843
+ "Action to perform (default: list). 'set' is a deprecated alias for 'update'.",
829
844
  },
830
845
  // list params
831
846
  outputVerbosity: {
@@ -850,7 +865,12 @@ const categoriesTools = [
850
865
  type: 'string',
851
866
  description: 'Category ID (action=update/delete, required)',
852
867
  },
868
+ categoryId: {
869
+ type: 'string',
870
+ description: 'DEPRECATED: alias for `id`. Will be removed in v3.8.0.',
871
+ },
853
872
  },
873
+ additionalProperties: false,
854
874
  required: [],
855
875
  },
856
876
  handler: async (args) => {
@@ -858,13 +878,22 @@ const categoriesTools = [
858
878
  switch (action) {
859
879
  case 'create':
860
880
  return handleCreateCategory(args);
881
+ case 'set': // deprecated alias
861
882
  case 'update':
862
883
  return handleUpdateCategory(args);
863
884
  case 'delete':
864
885
  return handleDeleteCategory(args);
865
886
  case 'list':
866
- default:
867
887
  return handleListCategories(args);
888
+ default:
889
+ return {
890
+ content: [
891
+ {
892
+ type: 'text',
893
+ text: `Unknown action '${action}'. Valid actions: list, create, update, delete.`,
894
+ },
895
+ ],
896
+ };
868
897
  }
869
898
  },
870
899
  },
@@ -901,6 +930,7 @@ const categoriesTools = [
901
930
  'set (replace all), add (append), remove (remove specific). Default: set',
902
931
  },
903
932
  },
933
+ additionalProperties: false,
904
934
  required: ['categories'],
905
935
  },
906
936
  handler: handleApplyCategory,
@@ -945,6 +975,7 @@ const categoriesTools = [
945
975
  'Where to put emails from this sender (action=set, default: focused)',
946
976
  },
947
977
  },
978
+ additionalProperties: false,
948
979
  required: [],
949
980
  },
950
981
  handler: async (args) => {
@@ -955,8 +986,16 @@ const categoriesTools = [
955
986
  case 'delete':
956
987
  return handleSetFocusedInboxOverride(args);
957
988
  case 'list':
958
- default:
959
989
  return handleGetFocusedInboxOverrides(args);
990
+ default:
991
+ return {
992
+ content: [
993
+ {
994
+ type: 'text',
995
+ text: `Unknown action '${action}'. Valid actions: list, set, delete.`,
996
+ },
997
+ ],
998
+ };
960
999
  }
961
1000
  },
962
1001
  },