@chrischall/microsoft-teams-mcp 0.6.2 → 0.8.0
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +184 -80
- package/dist/auth-fetchproxy.js +19 -23
- package/dist/bridge-scope.js +133 -0
- package/dist/bundle.js +5293 -2596
- package/dist/chatsvc.js +40 -3
- package/dist/index.js +4 -0
- package/dist/model.js +1 -1
- package/dist/sharepoint-auth.js +20 -22
- package/dist/substrate-auth.js +13 -18
- package/dist/tools/activity.js +36 -4
- package/dist/tools/attachment.js +26 -11
- package/dist/tools/changes.js +54 -10
- package/dist/tools/channels.js +4 -2
- package/dist/tools/chat-search.js +1 -1
- package/dist/tools/chat.js +5 -3
- package/dist/tools/conversation.js +19 -12
- package/dist/tools/cursor.js +6 -6
- package/dist/tools/export-attachments.js +114 -0
- package/dist/tools/export-format.js +101 -0
- package/dist/tools/export.js +552 -0
- package/dist/tools/format.js +3 -3
- package/dist/tools/from.js +1 -1
- package/dist/tools/hints.js +4 -0
- package/dist/tools/limit.js +1 -1
- package/dist/tools/listing.js +9 -8
- package/dist/tools/markread.js +14 -6
- package/dist/tools/react.js +10 -8
- package/dist/tools/search.js +7 -4
- package/dist/tools/send.js +9 -7
- package/dist/tools/titles.js +103 -20
- package/dist/tools/transcript.js +144 -0
- package/dist/tools/unread.js +9 -6
- package/dist/transcript.js +124 -0
- package/dist/version.js +1 -1
- package/mint.yaml +18 -0
- package/package.json +6 -2
- package/server.json +9 -2
- package/skills/teams-fpx/SKILL.md +15 -0
package/dist/tools/markread.js
CHANGED
|
@@ -6,6 +6,7 @@ import { confirmedSummary } from './confirm.js';
|
|
|
6
6
|
import { resolveListed } from './conversation.js';
|
|
7
7
|
import { wrapApiError } from './errors.js';
|
|
8
8
|
import { untrustedField, untrustedResult, UNTRUSTED_DESCRIPTION_SUFFIX } from './untrusted.js';
|
|
9
|
+
import { workMeta } from './hints.js';
|
|
9
10
|
const TOOL = 'teams_mark_read';
|
|
10
11
|
/** Messages read to find the newest one — one page; a page is not strictly ordered, so all of it is looked at. */
|
|
11
12
|
const NEWEST_PAGE = 50;
|
|
@@ -90,6 +91,7 @@ export async function confirmMarks(ctx, opts) {
|
|
|
90
91
|
id: p.summary.id,
|
|
91
92
|
title: p.summary.title,
|
|
92
93
|
kind: p.summary.kind,
|
|
94
|
+
...(p.summary.participants !== undefined ? { participants: p.summary.participants } : {}),
|
|
93
95
|
previous_horizon_message_id: p.previous,
|
|
94
96
|
up_to_message_id: p.target,
|
|
95
97
|
}))),
|
|
@@ -130,18 +132,19 @@ export function registerMarkReadTools(server, { chatsvc }) {
|
|
|
130
132
|
server.registerTool(TOOL, {
|
|
131
133
|
title: 'Mark a Teams conversation read',
|
|
132
134
|
description: 'Mark a chat or channel read in Teams, clearing its unread badge: moves the signed-in user\'s read ' +
|
|
133
|
-
'marker up to up_to_message_id (from
|
|
134
|
-
'in the conversation. conversation is an id or name as for
|
|
135
|
+
'marker up to up_to_message_id (from teams_list_messages), or by default up to the newest message ' +
|
|
136
|
+
'in the conversation. conversation is an id or name as for teams_list_messages; ' +
|
|
135
137
|
`"${SELF_CHAT}" (or "notes" / "self") is the user's own notes self-chat — use it to try this tool. ` +
|
|
136
138
|
'The marker never moves backwards: when it is already at or past the target, nothing is written and ' +
|
|
137
139
|
'status is "already_read". Returns the conversation, previous_horizon_message_id (null if it was never ' +
|
|
138
140
|
'opened) and new_horizon_message_id; status "unknown" means Teams did not confirm the move — retrying is ' +
|
|
139
|
-
'harmless.
|
|
141
|
+
'harmless. teams_list_messages and teams_list_unread_messages can do the same after a read with mark_read. ' +
|
|
140
142
|
CONFIRM_FLOW_SENTENCE +
|
|
141
143
|
' The preview shows the conversation, the message the marker moves to and where it was. ' +
|
|
142
144
|
CONFIRM_INJECTION_RULE +
|
|
143
145
|
UNTRUSTED_DESCRIPTION_SUFFIX,
|
|
144
146
|
annotations: toolAnnotations({ readOnly: false, destructive: false, idempotent: true, openWorld: true }),
|
|
147
|
+
_meta: workMeta('change', { aliases: ['mark read', 'mark as read', 'clear unread'] }),
|
|
145
148
|
inputSchema: {
|
|
146
149
|
conversation: z
|
|
147
150
|
.string()
|
|
@@ -152,7 +155,7 @@ export function registerMarkReadTools(server, { chatsvc }) {
|
|
|
152
155
|
.string()
|
|
153
156
|
.min(1)
|
|
154
157
|
.optional()
|
|
155
|
-
.describe('Mark read up to and including this message, as
|
|
158
|
+
.describe('Mark read up to and including this message, as teams_list_messages lists it (default: the ' +
|
|
156
159
|
'newest message in the conversation). Messages after it stay unread.'),
|
|
157
160
|
confirmToken: confirmTokenParam,
|
|
158
161
|
},
|
|
@@ -169,7 +172,7 @@ export function registerMarkReadTools(server, { chatsvc }) {
|
|
|
169
172
|
target = await chatsvc.getMessage(summary.id, up_to_message_id);
|
|
170
173
|
if (target === undefined) {
|
|
171
174
|
throw new McpToolError(`There is no message ${up_to_message_id} in this conversation to mark read up to.`, {
|
|
172
|
-
hint: 'Take message ids from
|
|
175
|
+
hint: 'Take message ids from teams_list_messages, or leave up_to_message_id out to mark it all read.',
|
|
173
176
|
});
|
|
174
177
|
}
|
|
175
178
|
}
|
|
@@ -201,7 +204,12 @@ export function registerMarkReadTools(server, { chatsvc }) {
|
|
|
201
204
|
// The client time in the body is minted when the marker moves, so it is not bound.
|
|
202
205
|
request: { method: 'PUT', path: horizonPath(summary.id) },
|
|
203
206
|
preview: {
|
|
204
|
-
conversation: untrustedField({
|
|
207
|
+
conversation: untrustedField({
|
|
208
|
+
id: summary.id,
|
|
209
|
+
title: summary.title,
|
|
210
|
+
kind: summary.kind,
|
|
211
|
+
...(summary.participants !== undefined ? { participants: summary.participants } : {}),
|
|
212
|
+
}),
|
|
205
213
|
up_to_message: untrustedField({
|
|
206
214
|
id: to,
|
|
207
215
|
sender: target.imdisplayname?.trim() || senderMri(target.from) || 'unknown',
|
package/dist/tools/react.js
CHANGED
|
@@ -5,6 +5,7 @@ import { htmlToText, normaliseMessage, senderMri } from '../model.js';
|
|
|
5
5
|
import { wrapApiError } from './errors.js';
|
|
6
6
|
import { resolveTarget, SELF_CHAT } from './send.js';
|
|
7
7
|
import { untrustedField, untrustedResult, UNTRUSTED_DESCRIPTION_SUFFIX } from './untrusted.js';
|
|
8
|
+
import { workMeta } from './hints.js';
|
|
8
9
|
const TOOL = 'teams_react';
|
|
9
10
|
/**
|
|
10
11
|
* The ✅ reaction's key, from the unicode-style key rule (see `KEY_RULE`) and
|
|
@@ -77,8 +78,8 @@ export function registerReactTools(server, { chatsvc }) {
|
|
|
77
78
|
server.registerTool(TOOL, {
|
|
78
79
|
title: 'React to a Teams message',
|
|
79
80
|
description: 'Add (or, with remove: true, withdraw) the signed-in user\'s reaction on a message in any chat or ' +
|
|
80
|
-
'channel. conversation is an id or name as for
|
|
81
|
-
'
|
|
81
|
+
'channel. conversation is an id or name as for teams_list_messages; message_id comes from ' +
|
|
82
|
+
'teams_list_messages. reaction is an emoji or name — thumbsup/👍/like, heart/❤️, laugh/😆, ' +
|
|
82
83
|
`surprised/😮, sad/😢, angry/😡, checkmark/✅ — or any raw Teams reaction key (e.g. fire, ` +
|
|
83
84
|
'1f389_partypopper); an emoji without a known key is refused with the rule for spelling its key. ' +
|
|
84
85
|
`conversation "${SELF_CHAT}" (or "notes" / "self") is the user's own notes self-chat — use it to try this tool. Everyone ` +
|
|
@@ -90,13 +91,14 @@ export function registerReactTools(server, { chatsvc }) {
|
|
|
90
91
|
CONFIRM_INJECTION_RULE +
|
|
91
92
|
UNTRUSTED_DESCRIPTION_SUFFIX,
|
|
92
93
|
annotations: toolAnnotations({ readOnly: false, destructive: false, idempotent: true, openWorld: true }),
|
|
94
|
+
_meta: workMeta('send', { aliases: ['react', 'like', 'thumbs up', 'reaction'] }),
|
|
93
95
|
inputSchema: {
|
|
94
96
|
conversation: z
|
|
95
97
|
.string()
|
|
96
98
|
.min(1)
|
|
97
99
|
.describe(`The conversation id (or "${SELF_CHAT}" — also by the name "notes" or "self" — for the self-chat), ` +
|
|
98
100
|
"or a case-insensitive substring of the chat title, channel name, team name or an untitled chat's participant names."),
|
|
99
|
-
message_id: z.string().min(1).describe('The message to react to, as
|
|
101
|
+
message_id: z.string().min(1).describe('The message to react to, as teams_list_messages lists it.'),
|
|
100
102
|
reaction: z.string().min(1).describe('An emoji (👍), a name (thumbsup) or a Teams reaction key (like, 1f389_partypopper).'),
|
|
101
103
|
remove: z.boolean().optional().describe('Withdraw this reaction instead of adding it (default false).'),
|
|
102
104
|
confirmToken: confirmTokenParam,
|
|
@@ -109,7 +111,7 @@ export function registerReactTools(server, { chatsvc }) {
|
|
|
109
111
|
const m = await chatsvc.getMessage(target.id, message_id);
|
|
110
112
|
if (m === undefined) {
|
|
111
113
|
throw new McpToolError(`There is no message ${message_id} in this conversation to react to.`, {
|
|
112
|
-
hint: 'Take message ids from
|
|
114
|
+
hint: 'Take message ids from teams_list_messages.',
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
const already = normaliseMessage(m, me).reactions?.some((r) => r.key === key && r.byMe) ?? false;
|
|
@@ -182,7 +184,7 @@ export function registerReactTools(server, { chatsvc }) {
|
|
|
182
184
|
verified,
|
|
183
185
|
warning: `Teams did not confirm this change (${why}), and reading the message back ` +
|
|
184
186
|
`${readBackFailed ? 'failed' : verified === null ? 'did not find it' : `did not show the reaction ${shown}`} — ` +
|
|
185
|
-
'check the message (
|
|
187
|
+
'check the message (teams_list_messages) before retrying.',
|
|
186
188
|
});
|
|
187
189
|
}
|
|
188
190
|
let warning;
|
|
@@ -190,15 +192,15 @@ export function registerReactTools(server, { chatsvc }) {
|
|
|
190
192
|
warning = `Teams did not confirm this change, but reading the message back shows the reaction ${shown}.`;
|
|
191
193
|
}
|
|
192
194
|
else if (readBackFailed) {
|
|
193
|
-
warning = 'Teams accepted the change, but reading the message back failed — check the message (
|
|
195
|
+
warning = 'Teams accepted the change, but reading the message back failed — check the message (teams_list_messages).';
|
|
194
196
|
}
|
|
195
197
|
else if (verified === null) {
|
|
196
198
|
warning =
|
|
197
199
|
'Teams accepted the change, but the message was not found on reading it back (it may have been deleted) — ' +
|
|
198
|
-
'check the conversation (
|
|
200
|
+
'check the conversation (teams_list_messages).';
|
|
199
201
|
}
|
|
200
202
|
else if (!verified) {
|
|
201
|
-
warning = `Teams accepted the change, but reading the message back did not show the reaction ${shown} — check the message (
|
|
203
|
+
warning = `Teams accepted the change, but reading the message back did not show the reaction ${shown} — check the message (teams_list_messages); the key may not be one Teams knows.`;
|
|
202
204
|
}
|
|
203
205
|
return untrustedResult({
|
|
204
206
|
status: remove ? 'removed' : 'reacted',
|
package/dist/tools/search.js
CHANGED
|
@@ -3,9 +3,10 @@ import { mapWithConcurrency, McpToolError, toolAnnotations } from '@chrischall/m
|
|
|
3
3
|
import { conversationKind, conversationSummary, isUserMessage, newestActivityMs, normaliseMessage, } from '../model.js';
|
|
4
4
|
import { arrivalMs, resolveListed } from './conversation.js';
|
|
5
5
|
import { CONFIRM_CONCURRENCY, isUnreachable } from './confirm.js';
|
|
6
|
-
import { enrichTitles } from './titles.js';
|
|
6
|
+
import { conversationName, enrichTitles, participantsOf } from './titles.js';
|
|
7
7
|
import { wrapApiError } from './errors.js';
|
|
8
8
|
import { untrustedResult, UNTRUSTED_DESCRIPTION_SUFFIX } from './untrusted.js';
|
|
9
|
+
import { workMeta } from './hints.js';
|
|
9
10
|
const DEFAULT_LIMIT = 25;
|
|
10
11
|
const MAX_LIMIT = 200;
|
|
11
12
|
/** The window searched when `since` is not given. */
|
|
@@ -58,8 +59,9 @@ function hitMessage(m) {
|
|
|
58
59
|
const { attachments: _a, reactions: _r, deleted: _d, ...rest } = m;
|
|
59
60
|
return rest;
|
|
60
61
|
}
|
|
62
|
+
/** A hit's conversation: its id and its name — title, kind, team, and an untitled chat's participants. */
|
|
61
63
|
function hitConversation(s) {
|
|
62
|
-
return
|
|
64
|
+
return conversationName(s);
|
|
63
65
|
}
|
|
64
66
|
export function registerSearchTools(server, { chatsvc, substrate }) {
|
|
65
67
|
server.registerTool('teams_search_messages', {
|
|
@@ -67,7 +69,7 @@ export function registerSearchTools(server, { chatsvc, substrate }) {
|
|
|
67
69
|
description: 'Find messages by text across the chats and channels the signed-in user is in. Hits come ' +
|
|
68
70
|
'newest first, each with its conversation (id, title, kind, team) and the message (id, time ' +
|
|
69
71
|
'ISO 8601, sender, fromMe (scan only), text, subject, replyTo for a channel reply); read a hit in context ' +
|
|
70
|
-
'with
|
|
72
|
+
'with teams_list_messages. conversation narrows to one chat or channel (id or name); from ' +
|
|
71
73
|
'keeps messages whose sender display name contains it; since (ISO 8601) sets how far back to ' +
|
|
72
74
|
`look (default the last ${DEFAULT_SINCE_DAYS} days); limit caps the hits (default ` +
|
|
73
75
|
`${DEFAULT_LIMIT}, max ${MAX_LIMIT}; total_hits and truncated say when there were more). ` +
|
|
@@ -87,6 +89,7 @@ export function registerSearchTools(server, { chatsvc, substrate }) {
|
|
|
87
89
|
'does NOT mark anything read.' +
|
|
88
90
|
UNTRUSTED_DESCRIPTION_SUFFIX,
|
|
89
91
|
annotations: toolAnnotations({ readOnly: true, openWorld: true }),
|
|
92
|
+
_meta: workMeta('lookup', { aliases: ['find a message', 'search teams', 'search chats'] }),
|
|
90
93
|
inputSchema: {
|
|
91
94
|
query: z
|
|
92
95
|
.string()
|
|
@@ -401,7 +404,7 @@ async function scanSearch(chatsvc, raw, me, { query, target, fromLc, cutoff, cap
|
|
|
401
404
|
conversations_not_scanned: notScanned,
|
|
402
405
|
messages_scanned: messagesScanned,
|
|
403
406
|
skipped_unreachable: unreachable,
|
|
404
|
-
...(partial.length > 0 ? { partially_scanned: partial.map((s) => ({ id: s.id, title: final(s).title })) } : {}),
|
|
407
|
+
...(partial.length > 0 ? { partially_scanned: partial.map((s) => ({ id: s.id, title: final(s).title, ...participantsOf(final(s)) })) } : {}),
|
|
405
408
|
...(leftOut
|
|
406
409
|
? {
|
|
407
410
|
hint: (notScanned > 0
|
package/dist/tools/send.js
CHANGED
|
@@ -5,6 +5,7 @@ import { htmlToText, isUserMessage, normaliseMessage, SELF_CHAT, senderMri } fro
|
|
|
5
5
|
import { resolveListed } from './conversation.js';
|
|
6
6
|
import { wrapApiError } from './errors.js';
|
|
7
7
|
import { THIRD_PARTY_NAMES_NOTE, untrustedField, untrustedResult, UNTRUSTED_DESCRIPTION_SUFFIX, } from './untrusted.js';
|
|
8
|
+
import { workMeta } from './hints.js';
|
|
8
9
|
const TOOL = 'teams_send_message';
|
|
9
10
|
/**
|
|
10
11
|
* The user's own notes chat — the one `48:*` system conversation that takes
|
|
@@ -33,7 +34,7 @@ const mentionArg = z.object({
|
|
|
33
34
|
});
|
|
34
35
|
/**
|
|
35
36
|
* The conversation a write goes to: `48:notes` (also by the names `notes` /
|
|
36
|
-
* `self`), else an id or name as `
|
|
37
|
+
* `self`), else an id or name as `teams_list_messages` resolves it. `verb` words the refusals ("post to",
|
|
37
38
|
* "react in").
|
|
38
39
|
*/
|
|
39
40
|
export async function resolveTarget(chatsvc, conversation, me, verb = 'post to') {
|
|
@@ -46,7 +47,7 @@ export async function resolveTarget(chatsvc, conversation, me, verb = 'post to')
|
|
|
46
47
|
}
|
|
47
48
|
const raw = await chatsvc.listConversations();
|
|
48
49
|
const s = await resolveListed(chatsvc, raw, me, conversation, verb);
|
|
49
|
-
return { id: s.id, title: s.title, kind: s.kind };
|
|
50
|
+
return { id: s.id, title: s.title, kind: s.kind, ...(s.participants !== undefined ? { participants: s.participants } : {}) };
|
|
50
51
|
}
|
|
51
52
|
/** Who has written in the conversation lately, by MRI → display name. */
|
|
52
53
|
async function recentSenders(chatsvc, conversationId) {
|
|
@@ -104,7 +105,7 @@ async function quoted(chatsvc, conversationId, id) {
|
|
|
104
105
|
const m = await chatsvc.getMessage(conversationId, id);
|
|
105
106
|
if (m === undefined) {
|
|
106
107
|
throw new McpToolError(`There is no message ${id} in this conversation to quote.`, {
|
|
107
|
-
hint: 'Take message ids from
|
|
108
|
+
hint: 'Take message ids from teams_list_messages.',
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
const mri = senderMri(m.from) ?? '';
|
|
@@ -119,7 +120,7 @@ async function threadRoot(chatsvc, channelId, id, me) {
|
|
|
119
120
|
const m = await chatsvc.getMessage(channelId, id);
|
|
120
121
|
if (m === undefined) {
|
|
121
122
|
throw new McpToolError(`There is no post ${id} in this channel to reply under.`, {
|
|
122
|
-
hint: 'Take the root post\'s id from
|
|
123
|
+
hint: 'Take the root post\'s id from teams_list_messages.',
|
|
123
124
|
});
|
|
124
125
|
}
|
|
125
126
|
const replyTo = normaliseMessage(m, me).replyTo;
|
|
@@ -140,14 +141,14 @@ function unconfirmedPost(conversation) {
|
|
|
140
141
|
conversation,
|
|
141
142
|
warning: `Teams did not confirm this post (${unknownOutcomeReason(e, { sent: 'the post' })}), ` +
|
|
142
143
|
'so it may already be in the conversation. Check the conversation before retrying ' +
|
|
143
|
-
'(
|
|
144
|
+
'(teams_list_messages); do not resend blindly.',
|
|
144
145
|
});
|
|
145
146
|
}
|
|
146
147
|
export function registerSendTools(server, { chatsvc }) {
|
|
147
148
|
server.registerTool(TOOL, {
|
|
148
149
|
title: 'Send a Teams message',
|
|
149
|
-
description: 'Post a message as the signed-in user to any chat or channel, by id (from
|
|
150
|
-
'
|
|
150
|
+
description: 'Post a message as the signed-in user to any chat or channel, by id (from teams_list_conversations / ' +
|
|
151
|
+
'teams_list_channels) or by name. text is plain text: it is escaped, newlines are kept, ' +
|
|
151
152
|
'and :key: shortcodes (e.g. :smile:, :1f389_partypopper:) become Teams emoji. reply_to in a ' +
|
|
152
153
|
'channel posts into that root post\'s thread; in a chat it quote-replies that message. quote ' +
|
|
153
154
|
'quote-replies a message in any conversation. mentions @-mention people: name_in_text must appear ' +
|
|
@@ -162,6 +163,7 @@ export function registerSendTools(server, { chatsvc }) {
|
|
|
162
163
|
CONFIRM_INJECTION_RULE +
|
|
163
164
|
UNTRUSTED_DESCRIPTION_SUFFIX,
|
|
164
165
|
annotations: toolAnnotations({ readOnly: false, destructive: true, idempotent: false, openWorld: true }),
|
|
166
|
+
_meta: workMeta('send', { aliases: ['message', 'send a message', 'reply', 'tell', 'post', 'chat'] }),
|
|
165
167
|
inputSchema: {
|
|
166
168
|
conversation: z
|
|
167
169
|
.string()
|
package/dist/tools/titles.js
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Names for conversations: untitled group chats and 1:1s titled from who is in
|
|
3
|
+
* them, and {@link nameConversations} for any tool whose result carries a
|
|
4
|
+
* conversation id.
|
|
3
5
|
*
|
|
4
6
|
* A group chat with no topic has nothing in the listing to call it by: the
|
|
5
7
|
* listing's stand-in is the last message's sender (`conversationSummary`).
|
|
6
8
|
* Live (2026-10-10, a real tenant) that made 15 different group chats all
|
|
7
9
|
* "King, Greg" — one person who posts everywhere — so a list could not tell
|
|
8
|
-
* them apart and name resolution was always ambiguous.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* them apart and name resolution was always ambiguous.
|
|
11
|
+
*
|
|
12
|
+
* This server has no member-list call: nothing in the recorded API notes
|
|
13
|
+
* (`docs/plans/2026-10-10-chatsvc-api.md`) or the fixtures shows one (a
|
|
14
|
+
* `threads/{id}` read, say) working with the captured chat-service token, so
|
|
15
|
+
* none is guessed at. Every message does carry its sender's name and MRI, so
|
|
16
|
+
* reading a chat's recent messages names the people in it — the members who
|
|
17
|
+
* WROTE in that sample, not every member.
|
|
18
|
+
*
|
|
19
|
+
* The title is a pure function of that sampled set of people: they are sorted
|
|
20
|
+
* by display name (lower-cased, compared by code unit — no locale rules — and
|
|
21
|
+
* by MRI on a tie), the first three named and the rest counted as "+N". Who
|
|
22
|
+
* posted most recently does not move it, so a chat keeps its name from one
|
|
23
|
+
* message to the next; it changes only when the sample's people do (someone
|
|
24
|
+
* new writes, or someone's last message ages out of the page read).
|
|
11
25
|
*
|
|
12
26
|
* An untitled 1:1 is named after the other person, whose MRI its id carries
|
|
13
27
|
* (`oneOnOnePeerMri`). The listing has their name only when they sent the last
|
|
@@ -24,7 +38,7 @@
|
|
|
24
38
|
* a failed read keeps the listing's title — it never fails the call.
|
|
25
39
|
*/
|
|
26
40
|
import { mapWithConcurrency } from '@chrischall/mcp-utils';
|
|
27
|
-
import { conversationKind, GROUP_TITLE_PREFIX, isFromMri, isUserMessage, oneOnOnePeerMri, senderMri, UNTITLED_GROUP_TITLE, UNTITLED_ONE_ON_ONE_TITLE, } from '../model.js';
|
|
41
|
+
import { conversationKind, GROUP_TITLE_PREFIX, isFromMri, isUserMessage, oneOnOnePeerMri, senderMri, UNTITLED_GROUP_TITLE, UNTITLED_ONE_ON_ONE_TITLE, summariseAll, } from '../model.js';
|
|
28
42
|
/** Recent messages read per untitled chat. */
|
|
29
43
|
export const TITLE_FETCH_MESSAGES = 30;
|
|
30
44
|
/** Their page size, so the read is one small request rather than a 200-message page. */
|
|
@@ -42,32 +56,45 @@ const NAME_SEPARATOR = '; ';
|
|
|
42
56
|
export function isUntitledGroup(c) {
|
|
43
57
|
return conversationKind(c) === 'group' && !c.threadProperties?.topic?.trim();
|
|
44
58
|
}
|
|
59
|
+
/** Lower-cased names by code unit, then MRI: the same order on every machine, whatever its locale. */
|
|
60
|
+
export function byNameThenMri(a, b) {
|
|
61
|
+
const x = a.name.toLowerCase();
|
|
62
|
+
const y = b.name.toLowerCase();
|
|
63
|
+
if (x !== y)
|
|
64
|
+
return x < y ? -1 : 1;
|
|
65
|
+
return a.mri < b.mri ? -1 : a.mri > b.mri ? 1 : 0;
|
|
66
|
+
}
|
|
45
67
|
/**
|
|
46
|
-
* The title for a group chat from its messages (newest first):
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
68
|
+
* The title for a group chat from its messages (newest first): its distinct
|
|
69
|
+
* senders other than the user, sorted by name ({@link byNameThenMri}), the
|
|
70
|
+
* first three named and the rest counted as "+N" — all of whom are its
|
|
71
|
+
* `participants`, in that order. Who wrote most recently does not change it:
|
|
72
|
+
* it depends only on who is in the messages read. A sender is distinct by MRI
|
|
73
|
+
* (named by their newest message, so a rename shows) and by display name
|
|
74
|
+
* ignoring case (of two accounts under one name, the lower MRI is kept), so
|
|
75
|
+
* one person under two accounts appears once. System events are skipped —
|
|
76
|
+
* their display name is whoever triggered them. `undefined` when no one else
|
|
77
|
+
* wrote.
|
|
52
78
|
*/
|
|
53
79
|
export function groupTitleFrom(messagesNewestFirst, meMri) {
|
|
54
|
-
const
|
|
55
|
-
const seenNames = new Set();
|
|
56
|
-
const participants = [];
|
|
80
|
+
const byMri = new Map();
|
|
57
81
|
for (const m of messagesNewestFirst) {
|
|
58
82
|
if (!isUserMessage(m))
|
|
59
83
|
continue;
|
|
60
84
|
const mri = senderMri(m.from);
|
|
61
85
|
const name = m.imdisplayname?.trim();
|
|
62
|
-
if (mri === undefined || mri === meMri || !name)
|
|
86
|
+
if (mri === undefined || mri === meMri || !name || byMri.has(mri))
|
|
63
87
|
continue;
|
|
88
|
+
byMri.set(mri, name);
|
|
89
|
+
}
|
|
90
|
+
const byName = new Map();
|
|
91
|
+
for (const [mri, name] of byMri) {
|
|
64
92
|
const key = name.toLowerCase();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
seenNames.add(key);
|
|
69
|
-
participants.push(name);
|
|
93
|
+
const kept = byName.get(key);
|
|
94
|
+
if (kept === undefined || mri < kept.mri)
|
|
95
|
+
byName.set(key, { name, mri });
|
|
70
96
|
}
|
|
97
|
+
const participants = [...byName.values()].sort(byNameThenMri).map((p) => p.name);
|
|
71
98
|
if (participants.length === 0)
|
|
72
99
|
return undefined;
|
|
73
100
|
const named = participants.slice(0, NAMED_PARTICIPANTS);
|
|
@@ -178,3 +205,59 @@ export async function enrichTitles(chatsvc, raw, me, rows) {
|
|
|
178
205
|
return { ...row, title: row.kind === 'oneOnOne' ? UNTITLED_ONE_ON_ONE_TITLE : UNTITLED_GROUP_TITLE };
|
|
179
206
|
});
|
|
180
207
|
}
|
|
208
|
+
/** `{ participants }` when a (titled) summary has them — an untitled chat's — else nothing, for spreading into a row. */
|
|
209
|
+
export function participantsOf(s) {
|
|
210
|
+
return s.participants !== undefined ? { participants: s.participants } : {};
|
|
211
|
+
}
|
|
212
|
+
/** The naming fields of a (titled) summary, for a result that carries a conversation by id. */
|
|
213
|
+
export function conversationName(s) {
|
|
214
|
+
return {
|
|
215
|
+
id: s.id,
|
|
216
|
+
kind: s.kind,
|
|
217
|
+
title: s.title,
|
|
218
|
+
...(s.team !== undefined ? { team: s.team } : {}),
|
|
219
|
+
...participantsOf(s),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Starts the listing read (conversations and the user's MRI) NOW and returns
|
|
224
|
+
* a namer that uses it, so a tool can overlap that read with its own work —
|
|
225
|
+
* the Activity feed scan — rather than waiting for it afterwards. A failed
|
|
226
|
+
* listing is swallowed as soon as it settles (no unhandled rejection, even
|
|
227
|
+
* if the namer is never called) and names nothing.
|
|
228
|
+
*/
|
|
229
|
+
export function conversationNamer(chatsvc) {
|
|
230
|
+
const listing = Promise.all([chatsvc.listConversations(), chatsvc.meMri()]).then(([raw, me]) => ({ raw, me }), () => undefined);
|
|
231
|
+
return async (ids) => {
|
|
232
|
+
const out = new Map();
|
|
233
|
+
const wanted = new Set(ids);
|
|
234
|
+
if (wanted.size === 0)
|
|
235
|
+
return out;
|
|
236
|
+
const read = await listing;
|
|
237
|
+
if (read === undefined)
|
|
238
|
+
return out;
|
|
239
|
+
try {
|
|
240
|
+
const rows = summariseAll(read.raw, read.me).filter((s) => wanted.has(s.id));
|
|
241
|
+
for (const s of await enrichTitles(chatsvc, read.raw, read.me, rows))
|
|
242
|
+
out.set(s.id, conversationName(s));
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
// Unnamed, not failed: the caller still has every id.
|
|
246
|
+
}
|
|
247
|
+
return out;
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Names for the conversations `ids`, for a tool whose result carries ids it
|
|
252
|
+
* did not get from the listing (the Activity feed, an attachment): one listing
|
|
253
|
+
* read, then {@link enrichTitles} on just those conversations, so an untitled
|
|
254
|
+
* group chat gets its participant title and a 1:1 the other person's name. An
|
|
255
|
+
* id the listing does not carry is left out. Never throws — a failed listing
|
|
256
|
+
* names nothing, a failed title read keeps the listing's title — since a name
|
|
257
|
+
* is never worth failing the call over.
|
|
258
|
+
*/
|
|
259
|
+
export async function nameConversations(chatsvc, ids) {
|
|
260
|
+
if (ids.length === 0)
|
|
261
|
+
return new Map();
|
|
262
|
+
return conversationNamer(chatsvc)(ids);
|
|
263
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { McpToolError, currentCallSignal, toolAnnotations } from '@chrischall/mcp-utils';
|
|
3
|
+
import { openExportSink, sanitizeExportFileName } from '@chrischall/mcp-utils/export';
|
|
4
|
+
import { listRecordings, parseRecording, parseVtt, renderTranscriptText, transcriptSpeakers } from '../transcript.js';
|
|
5
|
+
import { AmbiguousConversationError, ambiguousResult, resolveListed } from './conversation.js';
|
|
6
|
+
import { wrapApiError } from './errors.js';
|
|
7
|
+
import { workMeta } from './hints.js';
|
|
8
|
+
import { EXPORT_OUTPUT_ENV, EXPORT_SERVER_NAME } from './export.js';
|
|
9
|
+
import { untrustedResult, UNTRUSTED_DESCRIPTION_SUFFIX } from './untrusted.js';
|
|
10
|
+
/** Messages read looking for recordings (newest first). */
|
|
11
|
+
export const MAX_SCAN = 2000;
|
|
12
|
+
/** Most transcript characters returned inline; past this, `save` it. */
|
|
13
|
+
export const MAX_INLINE_CHARS = 200_000;
|
|
14
|
+
/** Other recordings listed beside the one returned. */
|
|
15
|
+
const MAX_OTHERS = 20;
|
|
16
|
+
/** A recording as the result shows it: `recording_id`, never the internal object id. */
|
|
17
|
+
function shown(r) {
|
|
18
|
+
const { message_id, object_id: _objectId, has_transcript: _has, duration_seconds: _secs, ...rest } = r;
|
|
19
|
+
return { recording_id: message_id, ...rest };
|
|
20
|
+
}
|
|
21
|
+
export function registerTranscriptTools(server, { chatsvc }) {
|
|
22
|
+
server.registerTool('teams_get_transcript', {
|
|
23
|
+
title: 'Get a Teams meeting transcript',
|
|
24
|
+
description: 'Get the transcript of a recorded Teams meeting from its meeting chat (by id or by name, as ' +
|
|
25
|
+
'teams_list_conversations lists it). Works even when the organizer disabled transcript download: it ' +
|
|
26
|
+
"reads Teams' own copy, the one the Recap tab shows. Returns the newest transcribed recording unless " +
|
|
27
|
+
'recording_id names another (other_recordings lists the rest, newest first): its time, duration and ' +
|
|
28
|
+
'play_url, the speakers, and the transcript — format "text" (default: one line per speaker turn, ' +
|
|
29
|
+
'"[hh:mm:ss] Name: words") or "vtt" (the WebVTT as Teams serves it). A transcript longer than ' +
|
|
30
|
+
`${MAX_INLINE_CHARS.toLocaleString('en-US')} characters is cut short (truncated: true). save: true writes ` +
|
|
31
|
+
`<meeting>-<time>.vtt and .txt instead (on a local install into a fresh folder under dest, else ${EXPORT_OUTPUT_ENV}, ` +
|
|
32
|
+
`else ~/Downloads/${EXPORT_SERVER_NAME}; on a hosted install as a zip behind a signed link) and returns where. ` +
|
|
33
|
+
"Teams' copy expires after some weeks: an expired one is an error, not another recording. " +
|
|
34
|
+
'Does not mark anything read.' +
|
|
35
|
+
UNTRUSTED_DESCRIPTION_SUFFIX,
|
|
36
|
+
_meta: workMeta('lookup', { aliases: ['transcript', 'meeting transcript', 'recording', 'recap', 'vtt', 'what was said'] }),
|
|
37
|
+
// save writes a local file the user asked for; nothing in Teams changes.
|
|
38
|
+
annotations: toolAnnotations({ readOnly: true, openWorld: true }),
|
|
39
|
+
inputSchema: {
|
|
40
|
+
conversation: z
|
|
41
|
+
.string()
|
|
42
|
+
.min(1)
|
|
43
|
+
.describe("The meeting chat's id, or a case-insensitive substring of its title."),
|
|
44
|
+
recording_id: z
|
|
45
|
+
.string()
|
|
46
|
+
.min(1)
|
|
47
|
+
.optional()
|
|
48
|
+
.describe('A recording_id from a previous result (recording or other_recordings). Default: the newest.'),
|
|
49
|
+
format: z.enum(['text', 'vtt']).optional().describe('"text" (default, readable turns) or "vtt" (raw WebVTT).'),
|
|
50
|
+
save: z
|
|
51
|
+
.boolean()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Write the transcript to files (.vtt and .txt) and return where, instead of the text. Default false.'),
|
|
54
|
+
dest: z
|
|
55
|
+
.string()
|
|
56
|
+
.min(1)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe(`With save, on a local install: the folder to create the output folder in (under ${EXPORT_OUTPUT_ENV} when ` +
|
|
59
|
+
'set, else under ~/Downloads, ~/Documents or ~/Desktop).'),
|
|
60
|
+
},
|
|
61
|
+
}, async ({ conversation, recording_id, format, save, dest }) => {
|
|
62
|
+
try {
|
|
63
|
+
const [raw, me] = await Promise.all([chatsvc.listConversations(), chatsvc.meMri()]);
|
|
64
|
+
const summary = await resolveListed(chatsvc, raw, me, conversation, 'read the transcript of');
|
|
65
|
+
const messages = await chatsvc.getMessages(summary.id, { max: MAX_SCAN });
|
|
66
|
+
const recordings = listRecordings(messages);
|
|
67
|
+
if (recordings.length === 0) {
|
|
68
|
+
throw new McpToolError(`No meeting transcript was found in "${summary.title}".`, {
|
|
69
|
+
hint: `Read its newest ${MAX_SCAN} messages. A transcript is posted to a meeting's own chat once a recorded ` +
|
|
70
|
+
'or transcribed meeting ends; pass the meeting chat (teams_list_conversations lists them).',
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
let chosen = recordings[0];
|
|
74
|
+
if (recording_id !== undefined) {
|
|
75
|
+
// Any message of a recording names it: a chunk posts several as its status moves.
|
|
76
|
+
const objectId = recordingObjectOf(messages, recording_id);
|
|
77
|
+
chosen = recordings.find((r) => r.message_id === recording_id || r.object_id === objectId);
|
|
78
|
+
if (chosen === undefined) {
|
|
79
|
+
throw new McpToolError(`No transcribed recording ${recording_id} in "${summary.title}".`, {
|
|
80
|
+
hint: `Its recordings, newest first: ${recordings
|
|
81
|
+
.slice(0, MAX_OTHERS)
|
|
82
|
+
.map((r) => `${r.message_id} (${r.time})`)
|
|
83
|
+
.join(', ')}.`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const vtt = await chatsvc.fetchTranscript(chosen.object_id);
|
|
88
|
+
const cues = parseVtt(vtt);
|
|
89
|
+
const text = renderTranscriptText(cues);
|
|
90
|
+
const others = recordings.filter((r) => r !== chosen).slice(0, MAX_OTHERS).map(shown);
|
|
91
|
+
const base = {
|
|
92
|
+
conversation: summary.id,
|
|
93
|
+
title: summary.title,
|
|
94
|
+
recording: shown(chosen),
|
|
95
|
+
speakers: transcriptSpeakers(cues),
|
|
96
|
+
cue_count: cues.length,
|
|
97
|
+
...(others.length > 0 ? { other_recordings: others } : {}),
|
|
98
|
+
};
|
|
99
|
+
if (save) {
|
|
100
|
+
const sink = await openExportSink({
|
|
101
|
+
name: EXPORT_SERVER_NAME,
|
|
102
|
+
envVar: EXPORT_OUTPUT_ENV,
|
|
103
|
+
baseName: 'teams-transcript',
|
|
104
|
+
...(dest !== undefined ? { dest } : {}),
|
|
105
|
+
...(currentCallSignal() !== undefined ? { signal: currentCallSignal() } : {}),
|
|
106
|
+
});
|
|
107
|
+
const stem = sanitizeExportFileName(`${chosen.title ?? summary.title}-${chosen.time.slice(0, 16).replace(':', '')}`);
|
|
108
|
+
const files = [await sink.addFile(`${stem}.vtt`, vtt, 'text/vtt'), await sink.addFile(`${stem}.txt`, `${text}\n`, 'text/plain')];
|
|
109
|
+
const loc = await sink.finish();
|
|
110
|
+
return untrustedResult({
|
|
111
|
+
...base,
|
|
112
|
+
mode: loc.mode,
|
|
113
|
+
location: loc.location,
|
|
114
|
+
...(loc.urlExpiresAt !== undefined ? { url_expires_at: loc.urlExpiresAt } : {}),
|
|
115
|
+
files: files.map((f) => ({ ...(f.path !== undefined ? { path: f.path } : { name: f.name }), bytes: f.bytes })),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const fmt = format ?? 'text';
|
|
119
|
+
const full = fmt === 'vtt' ? vtt : text;
|
|
120
|
+
const truncated = full.length > MAX_INLINE_CHARS;
|
|
121
|
+
return untrustedResult({
|
|
122
|
+
...base,
|
|
123
|
+
format: fmt,
|
|
124
|
+
transcript: truncated ? full.slice(0, MAX_INLINE_CHARS) : full,
|
|
125
|
+
...(truncated
|
|
126
|
+
? {
|
|
127
|
+
truncated: true,
|
|
128
|
+
hint: `The transcript is ${full.length.toLocaleString('en-US')} characters; pass save: true to get all of it as files.`,
|
|
129
|
+
}
|
|
130
|
+
: {}),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
if (err instanceof AmbiguousConversationError)
|
|
135
|
+
return untrustedResult(ambiguousResult(err));
|
|
136
|
+
throw wrapApiError(err, 'get the transcript');
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** The object id of the recording message `id`, if it is one (any of a chunk's messages names it). */
|
|
141
|
+
function recordingObjectOf(messages, id) {
|
|
142
|
+
const m = messages.find((x) => x.id === id);
|
|
143
|
+
return m === undefined ? undefined : parseRecording(m)?.object_id;
|
|
144
|
+
}
|
package/dist/tools/unread.js
CHANGED
|
@@ -3,7 +3,7 @@ import { CONFIRM_INJECTION_RULE, confirmTokenParam, mapWithConcurrency, McpToolE
|
|
|
3
3
|
import { conversationSummary, isUnread, lastChangeMs, matchConversations, normaliseMessage, oldestFirst, readHorizon, } from '../model.js';
|
|
4
4
|
import { CONFIRM_CONCURRENCY, confirmedSummary, confirmUnreadCandidates, isUnreachable, olderUnreadArg, olderUnreadConversations, olderUnreadReport, sinceCutoff, sinceDaysArg, } from './confirm.js';
|
|
5
5
|
import { GROUP_TITLE_DESCRIPTION, includeHiddenArg, isUnreadCandidateFor, MATCH_REASON_DESCRIPTION } from './listing.js';
|
|
6
|
-
import { enrichTitles } from './titles.js';
|
|
6
|
+
import { enrichTitles, participantsOf } from './titles.js';
|
|
7
7
|
import { wrapApiError } from './errors.js';
|
|
8
8
|
import { untrustedResult, UNTRUSTED_DESCRIPTION_SUFFIX } from './untrusted.js';
|
|
9
9
|
import { resolveTimeZone, TIME_ZONE_DESCRIPTION, tzArg } from './timezone.js';
|
|
@@ -14,6 +14,7 @@ import { DEFAULT_LIMIT } from './limit.js';
|
|
|
14
14
|
import { decodeFrom, FROM_DESCRIPTION, fromArg, fromReport, readFrom, takePage, tooBusy, } from './from.js';
|
|
15
15
|
import { fetchOutsideRoots, MAX_ROOT_FETCHES, rootBudget } from './roots.js';
|
|
16
16
|
import { advancesHorizon, applyMarks, confirmMarks, horizonMessageId, MARK_READ_DESCRIPTION, markReadArg, assertMarkReadFormat, } from './markread.js';
|
|
17
|
+
import { workMeta } from './hints.js';
|
|
17
18
|
const MAX_PER_CONVERSATION = 200;
|
|
18
19
|
const DEFAULT_PER_CONVERSATION = 50;
|
|
19
20
|
const MAX_CONVERSATIONS = 50;
|
|
@@ -39,7 +40,7 @@ const TRUNCATED_SKIP = {
|
|
|
39
40
|
skipped: 'truncated',
|
|
40
41
|
hint: 'The read marker was left where it was: per_conversation_limit cut this read, so unread messages older ' +
|
|
41
42
|
`than those returned were not returned. Read again with a larger per_conversation_limit (max ${MAX_PER_CONVERSATION}) ` +
|
|
42
|
-
'or with
|
|
43
|
+
'or with teams_list_messages (unread_only) to mark it read, or use teams_mark_read to mark it all read deliberately.',
|
|
43
44
|
};
|
|
44
45
|
/** Newest activity first; a conversation with no messages at all sorts last. */
|
|
45
46
|
function byLastActivityDesc(a, b) {
|
|
@@ -138,7 +139,7 @@ async function unreadFrom(chatsvc, raw, me, candidates, pos, { limit, timeZone,
|
|
|
138
139
|
/** The arguments that shape a per-conversation answer, which a `from` page replaces. */
|
|
139
140
|
const NOT_WITH_FROM = ['since_days', 'cursors', 'per_conversation_limit', 'max_conversations', 'mark_read', 'older_unread'];
|
|
140
141
|
export function registerUnreadTools(server, { chatsvc }) {
|
|
141
|
-
server.registerTool('
|
|
142
|
+
server.registerTool('teams_list_unread_messages', {
|
|
142
143
|
title: 'Get unread Teams messages',
|
|
143
144
|
description: 'Get every unread message across all the chats and channels the signed-in user is in ' +
|
|
144
145
|
'(or those matching kinds / query), grouped by conversation, most recent activity ' +
|
|
@@ -160,7 +161,7 @@ export function registerUnreadTools(server, { chatsvc }) {
|
|
|
160
161
|
'otherwise). Chats the user muted in Teams (muted: true) are left out too and counted in ' +
|
|
161
162
|
'muted_skipped, without being read; include_muted adds them. ' +
|
|
162
163
|
'Unread conversations past max_conversations are listed by id, title and unread_count in ' +
|
|
163
|
-
'more_unread_conversations; read one with
|
|
164
|
+
'more_unread_conversations; read one with teams_list_messages. A conversation that ' +
|
|
164
165
|
'could not be read is listed in errors and the rest still come back. total_unread covers ' +
|
|
165
166
|
'every unread conversation found; total_unread_exact is false when a per-conversation ' +
|
|
166
167
|
'limit truncated or a read failed. cursors ({ conversationId: messageId }) returns only unread ' +
|
|
@@ -195,6 +196,7 @@ export function registerUnreadTools(server, { chatsvc }) {
|
|
|
195
196
|
UNTRUSTED_DESCRIPTION_SUFFIX,
|
|
196
197
|
// A write only with mark_read, but a write: it moves the user's read markers (never backwards, so a repeat is a no-op).
|
|
197
198
|
annotations: toolAnnotations({ readOnly: false, destructive: false, idempotent: true, openWorld: true }),
|
|
199
|
+
_meta: workMeta('whats-new', { aliases: ['unread', 'unread messages', 'what did i miss', 'new messages'] }),
|
|
198
200
|
inputSchema: {
|
|
199
201
|
kinds: z
|
|
200
202
|
.array(z.enum(Object.keys(KIND_FILTERS)))
|
|
@@ -325,7 +327,7 @@ export function registerUnreadTools(server, { chatsvc }) {
|
|
|
325
327
|
plans.push({ summary, previous: horizonMessageId(conv), target });
|
|
326
328
|
}
|
|
327
329
|
if (plans.length > 0) {
|
|
328
|
-
const gate = await confirmMarks(ctx, { tool: '
|
|
330
|
+
const gate = await confirmMarks(ctx, { tool: 'teams_list_unread_messages', me, plans, confirmToken });
|
|
329
331
|
if (gate)
|
|
330
332
|
return gate;
|
|
331
333
|
}
|
|
@@ -353,7 +355,7 @@ export function registerUnreadTools(server, { chatsvc }) {
|
|
|
353
355
|
returned: messages.length,
|
|
354
356
|
hint: `Only the newest ${messages.length} unread messages were returned; pass a larger ` +
|
|
355
357
|
`per_conversation_limit (max ${MAX_PER_CONVERSATION}) or read the conversation ` +
|
|
356
|
-
'with
|
|
358
|
+
'with teams_list_messages (unread_only).',
|
|
357
359
|
},
|
|
358
360
|
}
|
|
359
361
|
: {}),
|
|
@@ -387,6 +389,7 @@ export function registerUnreadTools(server, { chatsvc }) {
|
|
|
387
389
|
more_unread_conversations: rest.map(({ summary, read }) => ({
|
|
388
390
|
id: summary.id,
|
|
389
391
|
title: summary.title,
|
|
392
|
+
...participantsOf(summary),
|
|
390
393
|
unread_count: read.messages.length,
|
|
391
394
|
})),
|
|
392
395
|
}
|