@beeper/desktop-mcp 4.2.3 → 4.6.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/LICENSE +1 -1
- package/README.md +18 -199
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +37 -0
- package/auth.js.map +1 -0
- package/auth.mjs +32 -0
- package/auth.mjs.map +1 -0
- package/code-tool-types.d.mts +7 -7
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +7 -7
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool-worker.d.mts.map +1 -1
- package/code-tool-worker.d.ts.map +1 -1
- package/code-tool-worker.js +103 -19
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +103 -19
- package/code-tool-worker.mjs.map +1 -1
- package/code-tool.d.mts +12 -3
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +12 -3
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +276 -95
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +273 -95
- package/code-tool.mjs.map +1 -1
- package/http.d.mts +6 -9
- package/http.d.mts.map +1 -1
- package/http.d.ts +6 -9
- package/http.d.ts.map +1 -1
- package/http.js +81 -47
- package/http.js.map +1 -1
- package/http.mjs +80 -43
- package/http.mjs.map +1 -1
- package/index.js +19 -50
- package/index.js.map +1 -1
- package/index.mjs +19 -50
- package/index.mjs.map +1 -1
- package/instructions.d.mts +2 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +2 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +48 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +45 -0
- package/instructions.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +203 -0
- package/methods.js.map +1 -0
- package/methods.mjs +199 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +9 -10
- package/options.d.mts.map +1 -1
- package/options.d.ts +9 -10
- package/options.d.ts.map +1 -1
- package/options.js +52 -363
- package/options.js.map +1 -1
- package/options.mjs +52 -363
- package/options.mjs.map +1 -1
- package/package.json +68 -82
- package/server.d.mts +10 -16
- package/server.d.mts.map +1 -1
- package/server.d.ts +10 -16
- package/server.d.ts.map +1 -1
- package/server.js +82 -105
- package/server.js.map +1 -1
- package/server.mjs +81 -100
- package/server.mjs.map +1 -1
- package/src/auth.ts +42 -0
- package/src/code-tool-types.ts +8 -5
- package/src/code-tool-worker.ts +118 -34
- package/src/code-tool.ts +359 -118
- package/src/http.ts +99 -50
- package/src/index.ts +22 -63
- package/src/instructions.ts +67 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +224 -0
- package/src/options.ts +69 -390
- package/src/server.ts +95 -121
- package/src/stdio.ts +6 -5
- package/src/{tools/types.ts → types.ts} +25 -5
- package/src/util.ts +25 -0
- package/stdio.d.mts +1 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +1 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +5 -4
- package/stdio.js.map +1 -1
- package/stdio.mjs +5 -4
- package/stdio.mjs.map +1 -1
- package/{tools/types.d.mts → types.d.mts} +10 -2
- package/types.d.mts.map +1 -0
- package/{tools/types.d.ts → types.d.ts} +10 -2
- package/types.d.ts.map +1 -0
- package/{tools/types.js → types.js} +12 -0
- package/types.js.map +1 -0
- package/{tools/types.mjs → types.mjs} +11 -0
- package/types.mjs.map +1 -0
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
- package/compat.d.mts +0 -58
- package/compat.d.mts.map +0 -1
- package/compat.d.ts +0 -58
- package/compat.d.ts.map +0 -1
- package/compat.js +0 -387
- package/compat.js.map +0 -1
- package/compat.mjs +0 -378
- package/compat.mjs.map +0 -1
- package/docs-search-tool.d.mts +0 -44
- package/docs-search-tool.d.mts.map +0 -1
- package/docs-search-tool.d.ts +0 -44
- package/docs-search-tool.d.ts.map +0 -1
- package/docs-search-tool.js +0 -43
- package/docs-search-tool.js.map +0 -1
- package/docs-search-tool.mjs +0 -39
- package/docs-search-tool.mjs.map +0 -1
- package/dynamic-tools.d.mts +0 -12
- package/dynamic-tools.d.mts.map +0 -1
- package/dynamic-tools.d.ts +0 -12
- package/dynamic-tools.d.ts.map +0 -1
- package/dynamic-tools.js +0 -135
- package/dynamic-tools.js.map +0 -1
- package/dynamic-tools.mjs +0 -132
- package/dynamic-tools.mjs.map +0 -1
- package/filtering.d.mts +0 -2
- package/filtering.d.mts.map +0 -1
- package/filtering.d.ts +0 -2
- package/filtering.d.ts.map +0 -1
- package/filtering.js +0 -20
- package/filtering.js.map +0 -1
- package/filtering.mjs +0 -13
- package/filtering.mjs.map +0 -1
- package/handlers/get-accounts.d.mts +0 -3
- package/handlers/get-accounts.d.mts.map +0 -1
- package/handlers/get-accounts.d.ts +0 -3
- package/handlers/get-accounts.d.ts.map +0 -1
- package/handlers/get-accounts.js +0 -32
- package/handlers/get-accounts.js.map +0 -1
- package/handlers/get-accounts.mjs +0 -28
- package/handlers/get-accounts.mjs.map +0 -1
- package/handlers/get-chat.d.mts +0 -3
- package/handlers/get-chat.d.mts.map +0 -1
- package/handlers/get-chat.d.ts +0 -3
- package/handlers/get-chat.d.ts.map +0 -1
- package/handlers/get-chat.js +0 -20
- package/handlers/get-chat.js.map +0 -1
- package/handlers/get-chat.mjs +0 -16
- package/handlers/get-chat.mjs.map +0 -1
- package/handlers/index.d.mts +0 -3
- package/handlers/index.d.mts.map +0 -1
- package/handlers/index.d.ts +0 -3
- package/handlers/index.d.ts.map +0 -1
- package/handlers/index.js +0 -30
- package/handlers/index.js.map +0 -1
- package/handlers/index.mjs +0 -27
- package/handlers/index.mjs.map +0 -1
- package/handlers/list-chats.d.mts +0 -3
- package/handlers/list-chats.d.mts.map +0 -1
- package/handlers/list-chats.d.ts +0 -3
- package/handlers/list-chats.d.ts.map +0 -1
- package/handlers/list-chats.js +0 -46
- package/handlers/list-chats.js.map +0 -1
- package/handlers/list-chats.mjs +0 -42
- package/handlers/list-chats.mjs.map +0 -1
- package/handlers/list-messages.d.mts +0 -3
- package/handlers/list-messages.d.mts.map +0 -1
- package/handlers/list-messages.d.ts +0 -3
- package/handlers/list-messages.d.ts.map +0 -1
- package/handlers/list-messages.js +0 -34
- package/handlers/list-messages.js.map +0 -1
- package/handlers/list-messages.mjs +0 -30
- package/handlers/list-messages.mjs.map +0 -1
- package/handlers/open-app.d.mts +0 -3
- package/handlers/open-app.d.mts.map +0 -1
- package/handlers/open-app.d.ts +0 -3
- package/handlers/open-app.d.ts.map +0 -1
- package/handlers/open-app.js +0 -26
- package/handlers/open-app.js.map +0 -1
- package/handlers/open-app.mjs +0 -22
- package/handlers/open-app.mjs.map +0 -1
- package/handlers/search-chats.d.mts +0 -3
- package/handlers/search-chats.d.mts.map +0 -1
- package/handlers/search-chats.d.ts +0 -3
- package/handlers/search-chats.d.ts.map +0 -1
- package/handlers/search-chats.js +0 -38
- package/handlers/search-chats.js.map +0 -1
- package/handlers/search-chats.mjs +0 -34
- package/handlers/search-chats.mjs.map +0 -1
- package/handlers/search-messages.d.mts +0 -3
- package/handlers/search-messages.d.mts.map +0 -1
- package/handlers/search-messages.d.ts +0 -3
- package/handlers/search-messages.d.ts.map +0 -1
- package/handlers/search-messages.js +0 -11
- package/handlers/search-messages.js.map +0 -1
- package/handlers/search-messages.mjs +0 -7
- package/handlers/search-messages.mjs.map +0 -1
- package/handlers/search.d.mts +0 -3
- package/handlers/search.d.mts.map +0 -1
- package/handlers/search.d.ts +0 -3
- package/handlers/search.d.ts.map +0 -1
- package/handlers/search.js +0 -29
- package/handlers/search.js.map +0 -1
- package/handlers/search.mjs +0 -25
- package/handlers/search.mjs.map +0 -1
- package/handlers/send-message.d.mts +0 -3
- package/handlers/send-message.d.mts.map +0 -1
- package/handlers/send-message.d.ts +0 -3
- package/handlers/send-message.d.ts.map +0 -1
- package/handlers/send-message.js +0 -20
- package/handlers/send-message.js.map +0 -1
- package/handlers/send-message.mjs +0 -16
- package/handlers/send-message.mjs.map +0 -1
- package/handlers/utils.d.mts +0 -29
- package/handlers/utils.d.mts.map +0 -1
- package/handlers/utils.d.ts +0 -29
- package/handlers/utils.d.ts.map +0 -1
- package/handlers/utils.js +0 -296
- package/handlers/utils.js.map +0 -1
- package/handlers/utils.mjs +0 -282
- package/handlers/utils.mjs.map +0 -1
- package/headers.d.mts +0 -4
- package/headers.d.mts.map +0 -1
- package/headers.d.ts +0 -4
- package/headers.d.ts.map +0 -1
- package/headers.js +0 -22
- package/headers.js.map +0 -1
- package/headers.mjs +0 -18
- package/headers.mjs.map +0 -1
- package/src/compat.ts +0 -483
- package/src/docs-search-tool.ts +0 -48
- package/src/dynamic-tools.ts +0 -159
- package/src/filtering.ts +0 -14
- package/src/handlers/get-accounts.ts +0 -28
- package/src/handlers/get-chat.ts +0 -18
- package/src/handlers/index.ts +0 -29
- package/src/handlers/list-chats.ts +0 -47
- package/src/handlers/list-messages.ts +0 -33
- package/src/handlers/open-app.ts +0 -20
- package/src/handlers/search-chats.ts +0 -39
- package/src/handlers/search-messages.ts +0 -8
- package/src/handlers/search.ts +0 -24
- package/src/handlers/send-message.ts +0 -17
- package/src/handlers/utils.ts +0 -381
- package/src/headers.ts +0 -23
- package/src/tools/accounts/get-accounts.ts +0 -34
- package/src/tools/chats/archive-chat.ts +0 -43
- package/src/tools/chats/get-chat.ts +0 -45
- package/src/tools/chats/reminders/clear-chat-reminder.ts +0 -41
- package/src/tools/chats/reminders/set-chat-reminder.ts +0 -54
- package/src/tools/chats/search-chats.ts +0 -104
- package/src/tools/index.ts +0 -92
- package/src/tools/messages/list-messages.ts +0 -51
- package/src/tools/messages/search-messages.ts +0 -123
- package/src/tools/messages/send-message.ts +0 -47
- package/src/tools/top-level/focus-app.ts +0 -52
- package/src/tools/top-level/search.ts +0 -41
- package/src/tools.ts +0 -1
- package/tools/accounts/get-accounts.d.mts +0 -45
- package/tools/accounts/get-accounts.d.mts.map +0 -1
- package/tools/accounts/get-accounts.d.ts +0 -45
- package/tools/accounts/get-accounts.d.ts.map +0 -1
- package/tools/accounts/get-accounts.js +0 -31
- package/tools/accounts/get-accounts.js.map +0 -1
- package/tools/accounts/get-accounts.mjs +0 -27
- package/tools/accounts/get-accounts.mjs.map +0 -1
- package/tools/chats/archive-chat.d.mts +0 -45
- package/tools/chats/archive-chat.d.mts.map +0 -1
- package/tools/chats/archive-chat.d.ts +0 -45
- package/tools/chats/archive-chat.d.ts.map +0 -1
- package/tools/chats/archive-chat.js +0 -40
- package/tools/chats/archive-chat.js.map +0 -1
- package/tools/chats/archive-chat.mjs +0 -36
- package/tools/chats/archive-chat.mjs.map +0 -1
- package/tools/chats/get-chat.d.mts +0 -45
- package/tools/chats/get-chat.d.mts.map +0 -1
- package/tools/chats/get-chat.d.ts +0 -45
- package/tools/chats/get-chat.d.ts.map +0 -1
- package/tools/chats/get-chat.js +0 -41
- package/tools/chats/get-chat.js.map +0 -1
- package/tools/chats/get-chat.mjs +0 -37
- package/tools/chats/get-chat.mjs.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.d.mts +0 -45
- package/tools/chats/reminders/clear-chat-reminder.d.mts.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.d.ts +0 -45
- package/tools/chats/reminders/clear-chat-reminder.d.ts.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.js +0 -38
- package/tools/chats/reminders/clear-chat-reminder.js.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.mjs +0 -34
- package/tools/chats/reminders/clear-chat-reminder.mjs.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.d.mts +0 -45
- package/tools/chats/reminders/set-chat-reminder.d.mts.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.d.ts +0 -45
- package/tools/chats/reminders/set-chat-reminder.d.ts.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.js +0 -51
- package/tools/chats/reminders/set-chat-reminder.js.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.mjs +0 -47
- package/tools/chats/reminders/set-chat-reminder.mjs.map +0 -1
- package/tools/chats/search-chats.d.mts +0 -45
- package/tools/chats/search-chats.d.mts.map +0 -1
- package/tools/chats/search-chats.d.ts +0 -45
- package/tools/chats/search-chats.d.ts.map +0 -1
- package/tools/chats/search-chats.js +0 -92
- package/tools/chats/search-chats.js.map +0 -1
- package/tools/chats/search-chats.mjs +0 -88
- package/tools/chats/search-chats.mjs.map +0 -1
- package/tools/index.d.mts +0 -10
- package/tools/index.d.mts.map +0 -1
- package/tools/index.d.ts +0 -10
- package/tools/index.d.ts.map +0 -1
- package/tools/index.js +0 -76
- package/tools/index.js.map +0 -1
- package/tools/index.mjs +0 -69
- package/tools/index.mjs.map +0 -1
- package/tools/messages/list-messages.d.mts +0 -45
- package/tools/messages/list-messages.d.mts.map +0 -1
- package/tools/messages/list-messages.d.ts +0 -45
- package/tools/messages/list-messages.d.ts.map +0 -1
- package/tools/messages/list-messages.js +0 -47
- package/tools/messages/list-messages.js.map +0 -1
- package/tools/messages/list-messages.mjs +0 -43
- package/tools/messages/list-messages.mjs.map +0 -1
- package/tools/messages/search-messages.d.mts +0 -45
- package/tools/messages/search-messages.d.mts.map +0 -1
- package/tools/messages/search-messages.d.ts +0 -45
- package/tools/messages/search-messages.d.ts.map +0 -1
- package/tools/messages/search-messages.js +0 -110
- package/tools/messages/search-messages.js.map +0 -1
- package/tools/messages/search-messages.mjs +0 -106
- package/tools/messages/search-messages.mjs.map +0 -1
- package/tools/messages/send-message.d.mts +0 -45
- package/tools/messages/send-message.d.mts.map +0 -1
- package/tools/messages/send-message.d.ts +0 -45
- package/tools/messages/send-message.d.ts.map +0 -1
- package/tools/messages/send-message.js +0 -43
- package/tools/messages/send-message.js.map +0 -1
- package/tools/messages/send-message.mjs +0 -39
- package/tools/messages/send-message.mjs.map +0 -1
- package/tools/top-level/focus-app.d.mts +0 -45
- package/tools/top-level/focus-app.d.mts.map +0 -1
- package/tools/top-level/focus-app.d.ts +0 -45
- package/tools/top-level/focus-app.d.ts.map +0 -1
- package/tools/top-level/focus-app.js +0 -47
- package/tools/top-level/focus-app.js.map +0 -1
- package/tools/top-level/focus-app.mjs +0 -43
- package/tools/top-level/focus-app.mjs.map +0 -1
- package/tools/top-level/search.d.mts +0 -45
- package/tools/top-level/search.d.mts.map +0 -1
- package/tools/top-level/search.d.ts +0 -45
- package/tools/top-level/search.d.ts.map +0 -1
- package/tools/top-level/search.js +0 -37
- package/tools/top-level/search.js.map +0 -1
- package/tools/top-level/search.mjs +0 -33
- package/tools/top-level/search.mjs.map +0 -1
- package/tools/types.d.mts.map +0 -1
- package/tools/types.d.ts.map +0 -1
- package/tools/types.js.map +0 -1
- package/tools/types.mjs.map +0 -1
- package/tools.d.mts +0 -2
- package/tools.d.mts.map +0 -1
- package/tools.d.ts +0 -2
- package/tools.d.ts.map +0 -1
- package/tools.js +0 -18
- package/tools.js.map +0 -1
- package/tools.mjs +0 -2
- package/tools.mjs.map +0 -1
package/src/handlers/utils.ts
DELETED
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
differenceInMilliseconds,
|
|
3
|
-
differenceInDays,
|
|
4
|
-
endOfDay,
|
|
5
|
-
format,
|
|
6
|
-
isToday,
|
|
7
|
-
isYesterday,
|
|
8
|
-
isSameYear,
|
|
9
|
-
parse,
|
|
10
|
-
} from 'date-fns';
|
|
11
|
-
import type * as Shared from '@beeper/desktop-api/resources/shared';
|
|
12
|
-
import type * as ChatsAPI from '@beeper/desktop-api/resources/chats/chats';
|
|
13
|
-
import { ToolCallResult } from '../tools/types';
|
|
14
|
-
|
|
15
|
-
const MILLIS_IN_WEEK = 86400000 * 7;
|
|
16
|
-
|
|
17
|
-
type Message = Shared.Message;
|
|
18
|
-
type Chat = ChatsAPI.Chat;
|
|
19
|
-
type User = Shared.User;
|
|
20
|
-
type MessageReaction = NonNullable<Message['reactions']>[number];
|
|
21
|
-
|
|
22
|
-
export const formatRelativeDate = (date: Date) => {
|
|
23
|
-
const timeDifference = differenceInMilliseconds(endOfDay(new Date()), date);
|
|
24
|
-
|
|
25
|
-
if (isToday(date)) return 'Today';
|
|
26
|
-
if (isYesterday(date)) return 'Yesterday';
|
|
27
|
-
|
|
28
|
-
return new Intl.DateTimeFormat(
|
|
29
|
-
'default',
|
|
30
|
-
timeDifference < MILLIS_IN_WEEK ?
|
|
31
|
-
{
|
|
32
|
-
weekday: 'long',
|
|
33
|
-
}
|
|
34
|
-
: isSameYear(date, new Date()) ?
|
|
35
|
-
{
|
|
36
|
-
weekday: 'short',
|
|
37
|
-
month: 'short',
|
|
38
|
-
day: 'numeric',
|
|
39
|
-
}
|
|
40
|
-
: {
|
|
41
|
-
year: 'numeric',
|
|
42
|
-
month: 'short',
|
|
43
|
-
day: 'numeric',
|
|
44
|
-
},
|
|
45
|
-
).format(date);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const formatBytes = (bytes: number, decimals = 0) => {
|
|
49
|
-
if (bytes === 0) return '0 B';
|
|
50
|
-
|
|
51
|
-
const k = 1024;
|
|
52
|
-
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
53
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
54
|
-
|
|
55
|
-
return `${Math.floor(parseFloat((bytes / k ** i).toFixed(decimals)))}${sizes[i]}`;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const skinToneRegex = /\uD83C[\uDFFB-\uDFFF]/g;
|
|
59
|
-
const removeSkinTone = (emojiString: string): string => emojiString.replace(skinToneRegex, '');
|
|
60
|
-
|
|
61
|
-
export function groupReactions(reactions: MessageReaction[]): { [key: string]: MessageReaction[] } {
|
|
62
|
-
const map: { [key: string]: MessageReaction[] } = {};
|
|
63
|
-
reactions.forEach((reaction) => {
|
|
64
|
-
if (!reaction.reactionKey) return;
|
|
65
|
-
const key = removeSkinTone(reaction.reactionKey);
|
|
66
|
-
map[key] ||= [];
|
|
67
|
-
map[key].push(reaction);
|
|
68
|
-
});
|
|
69
|
-
return map;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export const getParticipantName = (participant: User, preferFirstName?: boolean): string =>
|
|
73
|
-
participant.fullName && preferFirstName ?
|
|
74
|
-
participant.fullName.split(' ')[0]!
|
|
75
|
-
: participant.fullName ||
|
|
76
|
-
participant.username ||
|
|
77
|
-
participant.email ||
|
|
78
|
-
participant.phoneNumber ||
|
|
79
|
-
participant.id;
|
|
80
|
-
|
|
81
|
-
export const createOpenLink = (baseURL: string, localChatIDOrChatID: string, messageKey?: string) =>
|
|
82
|
-
`${baseURL}/open/${encodeURIComponent(localChatIDOrChatID)}${messageKey ? `/${messageKey}` : ''}`;
|
|
83
|
-
|
|
84
|
-
export const formatParticipantsToMarkdown = (participants: User[] | undefined, limit = 3): string => {
|
|
85
|
-
if (!participants || participants.length === 0) return '';
|
|
86
|
-
|
|
87
|
-
const names = participants
|
|
88
|
-
.slice(0, limit)
|
|
89
|
-
.map((p) => p.fullName || p.username || p.id)
|
|
90
|
-
.filter(Boolean);
|
|
91
|
-
|
|
92
|
-
if (participants.length > limit) {
|
|
93
|
-
const othersCount = participants.length - limit;
|
|
94
|
-
names.push(`& ${othersCount} other${othersCount === 1 ? '' : 's'}`);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return names.join(', ');
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export const formatReactionsToMarkdown = (
|
|
101
|
-
reactions: Message['reactions'],
|
|
102
|
-
participants?: Map<string, User>,
|
|
103
|
-
): string => {
|
|
104
|
-
if (!reactions || reactions.length === 0) return '';
|
|
105
|
-
|
|
106
|
-
const reactionMap = groupReactions(reactions);
|
|
107
|
-
const reactionParts: string[] = [];
|
|
108
|
-
for (const [reactionKey, reactionList] of Object.entries(reactionMap)) {
|
|
109
|
-
const count = reactionList.length;
|
|
110
|
-
const reactorNames = reactionList
|
|
111
|
-
.slice(0, 5)
|
|
112
|
-
.map((r) => {
|
|
113
|
-
if (!r.participantID) return null;
|
|
114
|
-
const participant = participants?.get(r.participantID);
|
|
115
|
-
return participant ? getParticipantName(participant) : r.participantID;
|
|
116
|
-
})
|
|
117
|
-
.filter(Boolean);
|
|
118
|
-
|
|
119
|
-
let reactorInfo = '';
|
|
120
|
-
if (reactorNames.length > 0) {
|
|
121
|
-
if (count > 5) {
|
|
122
|
-
const othersCount = count - 5;
|
|
123
|
-
reactorInfo = ` (${reactorNames.join(', ')} & ${othersCount} other${othersCount === 1 ? '' : 's'})`;
|
|
124
|
-
} else {
|
|
125
|
-
reactorInfo = ` (${reactorNames.join(', ')})`;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
reactionParts.push(`${reactionKey} ${count}${reactorInfo}`);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return reactionParts.length > 0 ? ` [${reactionParts.join(' ')}]` : '';
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export const formatAttachmentToMarkdown = (attachment: Shared.Attachment | undefined): string => {
|
|
136
|
-
if (!attachment) return '';
|
|
137
|
-
|
|
138
|
-
const typeEmoji =
|
|
139
|
-
{
|
|
140
|
-
img: '🖼',
|
|
141
|
-
video: '🎥',
|
|
142
|
-
audio: '🎵',
|
|
143
|
-
unknown: '📎',
|
|
144
|
-
}[attachment.type] || '📎';
|
|
145
|
-
|
|
146
|
-
const fileName = attachment.fileName || 'file';
|
|
147
|
-
const url = attachment.srcURL || '';
|
|
148
|
-
const hasBothDimensions =
|
|
149
|
-
typeof attachment.size?.width === 'number' && typeof attachment.size?.height === 'number';
|
|
150
|
-
|
|
151
|
-
const metaInfo: string[] = [];
|
|
152
|
-
if (attachment.fileSize) {
|
|
153
|
-
metaInfo.push(formatBytes(attachment.fileSize));
|
|
154
|
-
}
|
|
155
|
-
if (hasBothDimensions) {
|
|
156
|
-
metaInfo.push(`${attachment.size!.width}x${attachment.size!.height}`);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const metaString = metaInfo.length > 0 ? ` (${metaInfo.join(', ')})` : '';
|
|
160
|
-
|
|
161
|
-
return `\n${typeEmoji} [${fileName}](${url})${metaString}`;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export const formatChatToMarkdown = (chat: Chat, baseURL: string | undefined): string => {
|
|
165
|
-
const openURL = baseURL ? createOpenLink(baseURL, chat.localChatID ?? chat.id) : undefined;
|
|
166
|
-
const title = openURL ? `[${chat.title}](${openURL})` : chat.title;
|
|
167
|
-
const participantList =
|
|
168
|
-
chat.participants?.items ? formatParticipantsToMarkdown(chat.participants.items, 3) : '';
|
|
169
|
-
const participantInfo = participantList ? ` with ${participantList}` : '';
|
|
170
|
-
const lines: string[] = [];
|
|
171
|
-
lines.push(`\n## ${title} (chatID: ${chat.localChatID})`);
|
|
172
|
-
let chatLine = `Chat on ${chat.network}${participantInfo}.`;
|
|
173
|
-
if (typeof chat.unreadCount === 'number' && chat.unreadCount > 0) {
|
|
174
|
-
chatLine += ` It has ${chat.unreadCount} unread message${chat.unreadCount === 1 ? '' : 's'}.`;
|
|
175
|
-
}
|
|
176
|
-
lines.push(chatLine);
|
|
177
|
-
lines.push(`**Type**: ${chat.type}`);
|
|
178
|
-
if (chat.lastActivity) lines.push(`**Last Activity**: ${chat.lastActivity}`);
|
|
179
|
-
const status: string[] = [];
|
|
180
|
-
if (chat.isArchived) status.push('archived');
|
|
181
|
-
if (chat.isMuted) status.push('muted');
|
|
182
|
-
if (chat.isPinned) status.push('pinned');
|
|
183
|
-
if (status.length > 0) lines.push(`This chat is ${status.join(', ')}.`);
|
|
184
|
-
return lines.join('\n');
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const parseLocalDateKey = (key: string): Date => {
|
|
188
|
-
const parsed = parse(key, 'yyyy-MM-dd', new Date());
|
|
189
|
-
if (isNaN(parsed.getTime())) {
|
|
190
|
-
throw new Error(`Invalid date key: ${key}`);
|
|
191
|
-
}
|
|
192
|
-
return parsed;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
interface MessagesResponse {
|
|
196
|
-
items: Message[];
|
|
197
|
-
chats: Record<string, Chat>;
|
|
198
|
-
hasMore?: boolean;
|
|
199
|
-
oldestCursor?: string;
|
|
200
|
-
newestCursor?: string;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export const mapMessagesToText = (
|
|
204
|
-
output: Shared.MessagesCursorSearch,
|
|
205
|
-
input?: {
|
|
206
|
-
query?: string;
|
|
207
|
-
sender?: string;
|
|
208
|
-
mediaTypes?: string[];
|
|
209
|
-
},
|
|
210
|
-
ctx?: { apiBaseURL?: string; maxTextLength?: number },
|
|
211
|
-
) => {
|
|
212
|
-
const { items, hasMore } = output;
|
|
213
|
-
const chats = (output as any)?.body?.chats ?? {};
|
|
214
|
-
|
|
215
|
-
const messageCount = items.length;
|
|
216
|
-
const chatCount = Object.keys(chats).length;
|
|
217
|
-
|
|
218
|
-
// Determine if search filters would cause gaps in timeline
|
|
219
|
-
// Gaps occur when filtering by: query text, sender, or media types
|
|
220
|
-
// Gaps do NOT occur when only filtering by: chatIDs, accountIDs, chatType, or date ranges
|
|
221
|
-
const hasGapCausingFilters =
|
|
222
|
-
input && (input.query || input.sender || (input.mediaTypes && input.mediaTypes.length > 0));
|
|
223
|
-
|
|
224
|
-
const paginationInfo: string[] = [];
|
|
225
|
-
if (messageCount === 0) {
|
|
226
|
-
if (!chats || chatCount === 0) {
|
|
227
|
-
paginationInfo.push('No matching chats found');
|
|
228
|
-
} else {
|
|
229
|
-
paginationInfo.push(`No messages found in ${chatCount} chat${chatCount === 1 ? '' : 's'}`);
|
|
230
|
-
}
|
|
231
|
-
} else if (hasMore) {
|
|
232
|
-
paginationInfo.push(
|
|
233
|
-
`Found ${messageCount}+ messages across ${chatCount} chat${
|
|
234
|
-
chatCount === 1 ? '' : 's'
|
|
235
|
-
} (showing ${messageCount})`,
|
|
236
|
-
);
|
|
237
|
-
if (output.oldestCursor) {
|
|
238
|
-
paginationInfo.push(`Next page (older): cursor='${output.oldestCursor}', direction='before'`);
|
|
239
|
-
}
|
|
240
|
-
if (output.newestCursor) {
|
|
241
|
-
paginationInfo.push(`Previous page (newer): cursor='${output.newestCursor}', direction='after'`);
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
paginationInfo.push(
|
|
245
|
-
`Found ${messageCount} message${messageCount === 1 ? '' : 's'} across ${chatCount} chat${
|
|
246
|
-
chatCount === 1 ? '' : 's'
|
|
247
|
-
} (complete)`,
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
if (hasGapCausingFilters && messageCount > 0) {
|
|
252
|
-
paginationInfo.push('⚠️ Filtered results: only showing messages matching your search criteria.');
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const messagesByChat = new Map<string, typeof items>();
|
|
256
|
-
for (const message of items) {
|
|
257
|
-
const chatMessages = messagesByChat.get(message.chatID) || [];
|
|
258
|
-
chatMessages.push(message);
|
|
259
|
-
messagesByChat.set(message.chatID, chatMessages);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const chatSummaries: string[] = [];
|
|
263
|
-
for (const [chatID, messages] of messagesByChat) {
|
|
264
|
-
const chat = chats[chatID];
|
|
265
|
-
if (chat) {
|
|
266
|
-
chatSummaries.push(`# ${chat.title} [${messages.length} message${messages.length === 1 ? '' : 's'}]`);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const headerLines = [...paginationInfo, '', ...chatSummaries];
|
|
271
|
-
|
|
272
|
-
const summary = headerLines.join('\n');
|
|
273
|
-
|
|
274
|
-
const chatSections: string[] = [];
|
|
275
|
-
|
|
276
|
-
for (const [chatID, messages] of messagesByChat) {
|
|
277
|
-
const chat = chats[chatID];
|
|
278
|
-
if (!chat) continue;
|
|
279
|
-
|
|
280
|
-
const participantList =
|
|
281
|
-
chat.participants?.items ? formatParticipantsToMarkdown(chat.participants.items, 3) : '';
|
|
282
|
-
const participantInfo = participantList ? ` with ${participantList}` : '';
|
|
283
|
-
const openURL = ctx?.apiBaseURL ? createOpenLink(ctx.apiBaseURL, chat.localChatID ?? chat.id) : undefined;
|
|
284
|
-
const title = openURL ? `[${chat.title}](${openURL})` : chat.title;
|
|
285
|
-
chatSections.push(`# ${title} (chatID: ${chat.localChatID})`);
|
|
286
|
-
chatSections.push(`Chat on ${chat.network}${participantInfo}.`);
|
|
287
|
-
chatSections.push('');
|
|
288
|
-
|
|
289
|
-
const messagesByDate = new Map<string, Message[]>();
|
|
290
|
-
for (const message of messages) {
|
|
291
|
-
const dateKey = format(new Date(message.timestamp), 'yyyy-MM-dd');
|
|
292
|
-
const dateMessages = messagesByDate.get(dateKey) || [];
|
|
293
|
-
dateMessages.push(message);
|
|
294
|
-
messagesByDate.set(dateKey, dateMessages);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const sortedDates = Array.from(messagesByDate.keys()).sort();
|
|
298
|
-
|
|
299
|
-
const participantMap =
|
|
300
|
-
chat?.participants?.items ?
|
|
301
|
-
new Map<string, User>(chat.participants.items.map((p: User) => [p.id, p]))
|
|
302
|
-
: undefined;
|
|
303
|
-
|
|
304
|
-
for (let i = 0; i < sortedDates.length; i++) {
|
|
305
|
-
const dateKey = sortedDates[i]!;
|
|
306
|
-
const dateObj = parseLocalDateKey(dateKey);
|
|
307
|
-
const relativeTime = formatRelativeDate(dateObj);
|
|
308
|
-
chatSections.push(`## ${relativeTime} (${dateKey})`);
|
|
309
|
-
chatSections.push('');
|
|
310
|
-
|
|
311
|
-
const dateMessages = messagesByDate.get(dateKey) || [];
|
|
312
|
-
dateMessages.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
313
|
-
|
|
314
|
-
for (const message of dateMessages) {
|
|
315
|
-
const time = new Date(message.timestamp);
|
|
316
|
-
const timeStr = format(time, 'HH:mm');
|
|
317
|
-
|
|
318
|
-
const baseSenderName = message.senderName || message.senderID;
|
|
319
|
-
const senderName = message.isSender ? `${baseSenderName} (You)` : baseSenderName;
|
|
320
|
-
|
|
321
|
-
const maxTextLength = ctx?.maxTextLength ?? 1000;
|
|
322
|
-
let text = message.text || '';
|
|
323
|
-
if (text && text.length > maxTextLength) {
|
|
324
|
-
const remainingChars = text.length - maxTextLength;
|
|
325
|
-
text = text.substring(0, maxTextLength) + `... [+${remainingChars} chars]`;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const attachment = message.attachments?.[0]; // Assume single attachment
|
|
329
|
-
const attachmentChatID = chat.localChatID ?? chat.id;
|
|
330
|
-
const attachmentLink =
|
|
331
|
-
attachment && attachmentChatID ?
|
|
332
|
-
`\n📎 [${attachment.fileName || 'attachment'}](beeper-mcp://attachments/${attachmentChatID}/${
|
|
333
|
-
message.id
|
|
334
|
-
}/0)`
|
|
335
|
-
: '';
|
|
336
|
-
const reactionsStr = formatReactionsToMarkdown(message.reactions, participantMap);
|
|
337
|
-
|
|
338
|
-
const sortKeyLink =
|
|
339
|
-
chat.localChatID ?
|
|
340
|
-
`([open at sort key](${createOpenLink(
|
|
341
|
-
ctx?.apiBaseURL || '',
|
|
342
|
-
chat.localChatID,
|
|
343
|
-
String(message.sortKey),
|
|
344
|
-
)}))`
|
|
345
|
-
: `(sortKey: ${message.sortKey})`;
|
|
346
|
-
const messageStr = `**${senderName}** (${timeStr}): ${text}${attachmentLink}${reactionsStr} ${sortKeyLink}`;
|
|
347
|
-
|
|
348
|
-
chatSections.push(messageStr);
|
|
349
|
-
chatSections.push('');
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// Add date gap indicator when dates are not consecutive
|
|
353
|
-
if (i < sortedDates.length - 1) {
|
|
354
|
-
const nextDateKey = sortedDates[i + 1]!;
|
|
355
|
-
const currentDate = parseLocalDateKey(dateKey!);
|
|
356
|
-
const nextDate = parseLocalDateKey(nextDateKey);
|
|
357
|
-
const dayDiff = differenceInDays(nextDate, currentDate);
|
|
358
|
-
|
|
359
|
-
// Only show gap if dates are not consecutive
|
|
360
|
-
if (dayDiff > 1) {
|
|
361
|
-
const gapDays = dayDiff - 1;
|
|
362
|
-
chatSections.push(`*[... ${gapDays} day${gapDays === 1 ? '' : 's'} gap ...]*`);
|
|
363
|
-
chatSections.push('');
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
return [summary, '', ...chatSections].join('\n');
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
export function asMarkdownContentResult(text: string | string[]): ToolCallResult {
|
|
373
|
-
return {
|
|
374
|
-
content: [
|
|
375
|
-
{
|
|
376
|
-
type: 'text',
|
|
377
|
-
text: Array.isArray(text) ? text.join('\n') : text,
|
|
378
|
-
},
|
|
379
|
-
],
|
|
380
|
-
};
|
|
381
|
-
}
|
package/src/headers.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { IncomingMessage } from 'node:http';
|
|
4
|
-
import { ClientOptions } from '@beeper/desktop-api';
|
|
5
|
-
|
|
6
|
-
export const parseAuthHeaders = (req: IncomingMessage): Partial<ClientOptions> => {
|
|
7
|
-
if (req.headers.authorization) {
|
|
8
|
-
const scheme = req.headers.authorization.split(' ')[0]!;
|
|
9
|
-
const value = req.headers.authorization.slice(scheme.length + 1);
|
|
10
|
-
switch (scheme) {
|
|
11
|
-
case 'Bearer':
|
|
12
|
-
return { accessToken: req.headers.authorization.slice('Bearer '.length) };
|
|
13
|
-
default:
|
|
14
|
-
throw new Error(`Unsupported authorization scheme`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const accessToken =
|
|
19
|
-
Array.isArray(req.headers['x-beeper-access-token']) ?
|
|
20
|
-
req.headers['x-beeper-access-token'][0]
|
|
21
|
-
: req.headers['x-beeper-access-token'];
|
|
22
|
-
return { accessToken };
|
|
23
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Metadata, asTextContentResult } from '@beeper/desktop-mcp/tools/types';
|
|
4
|
-
|
|
5
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import BeeperDesktop from '@beeper/desktop-api';
|
|
7
|
-
|
|
8
|
-
export const metadata: Metadata = {
|
|
9
|
-
resource: 'accounts',
|
|
10
|
-
operation: 'read',
|
|
11
|
-
tags: ['accounts'],
|
|
12
|
-
httpMethod: 'get',
|
|
13
|
-
httpPath: '/v1/accounts',
|
|
14
|
-
operationId: 'getAccounts',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const tool: Tool = {
|
|
18
|
-
name: 'get_accounts',
|
|
19
|
-
description: 'List connected accounts on this device.',
|
|
20
|
-
inputSchema: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {},
|
|
23
|
-
required: [],
|
|
24
|
-
},
|
|
25
|
-
annotations: {
|
|
26
|
-
readOnlyHint: true,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const handler = async (client: BeeperDesktop, args: Record<string, unknown> | undefined) => {
|
|
31
|
-
return asTextContentResult(await client.accounts.list());
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default { metadata, tool, handler };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Metadata, asTextContentResult } from '@beeper/desktop-mcp/tools/types';
|
|
4
|
-
|
|
5
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import BeeperDesktop from '@beeper/desktop-api';
|
|
7
|
-
|
|
8
|
-
export const metadata: Metadata = {
|
|
9
|
-
resource: 'chats',
|
|
10
|
-
operation: 'write',
|
|
11
|
-
tags: ['chats'],
|
|
12
|
-
httpMethod: 'post',
|
|
13
|
-
httpPath: '/v1/chats/{chatID}/archive',
|
|
14
|
-
operationId: 'archiveChat',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const tool: Tool = {
|
|
18
|
-
name: 'archive_chat',
|
|
19
|
-
description: 'Archive or unarchive a chat.',
|
|
20
|
-
inputSchema: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
chatID: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
description: 'Unique identifier of the chat.',
|
|
26
|
-
},
|
|
27
|
-
archived: {
|
|
28
|
-
type: 'boolean',
|
|
29
|
-
description: 'True to archive, false to unarchive',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
required: ['chatID'],
|
|
33
|
-
},
|
|
34
|
-
annotations: {},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const handler = async (client: BeeperDesktop, args: Record<string, unknown> | undefined) => {
|
|
38
|
-
const { chatID, ...body } = args as any;
|
|
39
|
-
const response = await client.chats.archive(chatID, body).asResponse();
|
|
40
|
-
return asTextContentResult(await response.text());
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default { metadata, tool, handler };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Metadata, asTextContentResult } from '@beeper/desktop-mcp/tools/types';
|
|
4
|
-
|
|
5
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import BeeperDesktop from '@beeper/desktop-api';
|
|
7
|
-
|
|
8
|
-
export const metadata: Metadata = {
|
|
9
|
-
resource: 'chats',
|
|
10
|
-
operation: 'read',
|
|
11
|
-
tags: ['chats'],
|
|
12
|
-
httpMethod: 'get',
|
|
13
|
-
httpPath: '/v1/chats/{chatID}',
|
|
14
|
-
operationId: 'getChat',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const tool: Tool = {
|
|
18
|
-
name: 'get_chat',
|
|
19
|
-
description: 'Get chat details: metadata, participants (limited), last activity.',
|
|
20
|
-
inputSchema: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
chatID: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
description: 'Unique identifier of the chat.',
|
|
26
|
-
},
|
|
27
|
-
maxParticipantCount: {
|
|
28
|
-
type: 'integer',
|
|
29
|
-
description:
|
|
30
|
-
'Maximum number of participants to return. Use -1 for all; otherwise 0–500. Defaults to all (-1).',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
required: ['chatID'],
|
|
34
|
-
},
|
|
35
|
-
annotations: {
|
|
36
|
-
readOnlyHint: true,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const handler = async (client: BeeperDesktop, args: Record<string, unknown> | undefined) => {
|
|
41
|
-
const { chatID, ...body } = args as any;
|
|
42
|
-
return asTextContentResult(await client.chats.retrieve(chatID, body));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default { metadata, tool, handler };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Metadata, asTextContentResult } from '@beeper/desktop-mcp/tools/types';
|
|
4
|
-
|
|
5
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import BeeperDesktop from '@beeper/desktop-api';
|
|
7
|
-
|
|
8
|
-
export const metadata: Metadata = {
|
|
9
|
-
resource: 'chats.reminders',
|
|
10
|
-
operation: 'write',
|
|
11
|
-
tags: ['chats'],
|
|
12
|
-
httpMethod: 'delete',
|
|
13
|
-
httpPath: '/v1/chats/{chatID}/reminders',
|
|
14
|
-
operationId: 'clearChatReminder',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const tool: Tool = {
|
|
18
|
-
name: 'clear_chat_reminder',
|
|
19
|
-
description: 'Clear a chat reminder.',
|
|
20
|
-
inputSchema: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
chatID: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
description: 'Unique identifier of the chat.',
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
required: ['chatID'],
|
|
29
|
-
},
|
|
30
|
-
annotations: {
|
|
31
|
-
idempotentHint: true,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const handler = async (client: BeeperDesktop, args: Record<string, unknown> | undefined) => {
|
|
36
|
-
const { chatID, ...body } = args as any;
|
|
37
|
-
const response = await client.chats.reminders.delete(chatID).asResponse();
|
|
38
|
-
return asTextContentResult(await response.text());
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default { metadata, tool, handler };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { Metadata, asTextContentResult } from '@beeper/desktop-mcp/tools/types';
|
|
4
|
-
|
|
5
|
-
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import BeeperDesktop from '@beeper/desktop-api';
|
|
7
|
-
|
|
8
|
-
export const metadata: Metadata = {
|
|
9
|
-
resource: 'chats.reminders',
|
|
10
|
-
operation: 'write',
|
|
11
|
-
tags: ['chats'],
|
|
12
|
-
httpMethod: 'post',
|
|
13
|
-
httpPath: '/v1/chats/{chatID}/reminders',
|
|
14
|
-
operationId: 'setChatReminder',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const tool: Tool = {
|
|
18
|
-
name: 'set_chat_reminder',
|
|
19
|
-
description: 'Set a reminder for a chat at a specific time.',
|
|
20
|
-
inputSchema: {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
chatID: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
description: 'Unique identifier of the chat.',
|
|
26
|
-
},
|
|
27
|
-
reminder: {
|
|
28
|
-
type: 'object',
|
|
29
|
-
description: 'Reminder configuration',
|
|
30
|
-
properties: {
|
|
31
|
-
remindAtMs: {
|
|
32
|
-
type: 'number',
|
|
33
|
-
description: 'Unix timestamp in milliseconds when reminder should trigger',
|
|
34
|
-
},
|
|
35
|
-
dismissOnIncomingMessage: {
|
|
36
|
-
type: 'boolean',
|
|
37
|
-
description: 'Cancel reminder if someone messages in the chat',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
required: ['remindAtMs'],
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
required: ['chatID', 'reminder'],
|
|
44
|
-
},
|
|
45
|
-
annotations: {},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const handler = async (client: BeeperDesktop, args: Record<string, unknown> | undefined) => {
|
|
49
|
-
const { chatID, ...body } = args as any;
|
|
50
|
-
const response = await client.chats.reminders.create(chatID, body).asResponse();
|
|
51
|
-
return asTextContentResult(await response.text());
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default { metadata, tool, handler };
|