Skip to content

Commit e404d7e

Browse files
feat(api): manual updates
1 parent 540c168 commit e404d7e

File tree

15 files changed

+265
-7
lines changed

15 files changed

+265
-7
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 14
1+
configured_endpoints: 16
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/beeper%2Fbeeper-desktop-api-9f5190d7df873112f3512b5796cd95341f0fa0d2585488d3e829be80ee6045ce.yml
33
openapi_spec_hash: ba834200758376aaea47b2a276f64c1b
4-
config_hash: f83b2b6eb86f2dd68101065998479cb2
4+
config_hash: be3f3b31e322be0f4de6a23e32ab004c

api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ Types:
5050

5151
- <code><a href="./src/resources/chats/chats.ts">Chat</a></code>
5252
- <code><a href="./src/resources/chats/chats.ts">ChatCreateResponse</a></code>
53+
- <code><a href="./src/resources/chats/chats.ts">ChatListResponse</a></code>
5354

5455
Methods:
5556

5657
- <code title="post /v1/chats">client.chats.<a href="./src/resources/chats/chats.ts">create</a>({ ...params }) -> ChatCreateResponse</code>
5758
- <code title="get /v1/chats/{chatID}">client.chats.<a href="./src/resources/chats/chats.ts">retrieve</a>(chatID, { ...params }) -> Chat</code>
59+
- <code title="get /v1/chats">client.chats.<a href="./src/resources/chats/chats.ts">list</a>({ ...params }) -> ChatListResponsesCursor</code>
5860
- <code title="post /v1/chats/{chatID}/archive">client.chats.<a href="./src/resources/chats/chats.ts">archive</a>(chatID, { ...params }) -> BaseResponse</code>
5961
- <code title="get /v1/chats/search">client.chats.<a href="./src/resources/chats/chats.ts">search</a>({ ...params }) -> ChatsCursor</code>
6062

@@ -73,6 +75,7 @@ Types:
7375

7476
Methods:
7577

78+
- <code title="get /v1/messages">client.messages.<a href="./src/resources/messages.ts">list</a>({ ...params }) -> MessagesCursor</code>
7679
- <code title="get /v1/messages/search">client.messages.<a href="./src/resources/messages.ts">search</a>({ ...params }) -> MessagesCursor</code>
7780
- <code title="post /v1/messages">client.messages.<a href="./src/resources/messages.ts">send</a>({ ...params }) -> MessageSendResponse</code>
7881

packages/mcp-server/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ The following tools are available in this MCP server.
220220

221221
### Resource `accounts`:
222222

223-
- `get_accounts` (`read`) tags: [accounts]: List connected accounts on this device. Use to pick account context.
223+
- `get_accounts` (`read`) tags: [accounts]: List connected accounts on this device.
224224

225225
### Resource `contacts`:
226226

@@ -230,6 +230,7 @@ The following tools are available in this MCP server.
230230

231231
- `create_chats` (`write`): Create a single or group chat on a specific account using participant IDs and optional title.
232232
- `get_chat` (`read`) tags: [chats]: Get chat details: metadata, participants (limited), last activity.
233+
- `list_chats` (`read`): List all chats sorted by last activity (most recent first). Combines all accounts into a single paginated list.
233234
- `archive_chat` (`write`) tags: [chats]: Archive or unarchive a chat.
234235
- `search_chats` (`read`) tags: [chats]: Search chats by title/network or participants using Beeper Desktop's renderer algorithm. Optional 'scope'.
235236

@@ -240,6 +241,7 @@ The following tools are available in this MCP server.
240241

241242
### Resource `messages`:
242243

244+
- `list_messages` (`read`): List all messages in a chat with cursor-based pagination. Sorted by timestamp.
243245
- `search_messages` (`read`) tags: [messages]: Search messages across chats using Beeper's message index.
244246
- When to use: find messages by text and/or filters (chatIDs, accountIDs, chatType, media type filters, sender, date ranges).
245247
- CRITICAL: Query is LITERAL WORD MATCHING, NOT semantic search! Only finds messages containing these EXACT words.

packages/mcp-server/src/tools/accounts/get-accounts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const metadata: Metadata = {
1616

1717
export const tool: Tool = {
1818
name: 'get_accounts',
19-
description: 'List connected accounts on this device. Use to pick account context.',
19+
description: 'List connected accounts on this device.',
2020
inputSchema: {
2121
type: 'object',
2222
properties: {},
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { Metadata, asTextContentResult } from '@beeper/desktop-api-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: [],
12+
httpMethod: 'get',
13+
httpPath: '/v1/chats',
14+
operationId: 'listChats',
15+
};
16+
17+
export const tool: Tool = {
18+
name: 'list_chats',
19+
description:
20+
'List all chats sorted by last activity (most recent first). Combines all accounts into a single paginated list.',
21+
inputSchema: {
22+
type: 'object',
23+
properties: {
24+
accountIDs: {
25+
type: 'array',
26+
description: 'Limit to specific account IDs. If omitted, fetches from all accounts.',
27+
items: {
28+
type: 'string',
29+
description: 'Account ID this resource belongs to.',
30+
},
31+
},
32+
cursor: {
33+
type: 'string',
34+
description:
35+
'Timestamp cursor (milliseconds since epoch) for pagination. Use with direction to navigate results.',
36+
},
37+
direction: {
38+
type: 'string',
39+
description:
40+
"Pagination direction used with 'cursor': 'before' fetches older results, 'after' fetches newer results. Defaults to 'before' when only 'cursor' is provided.",
41+
enum: ['after', 'before'],
42+
},
43+
limit: {
44+
type: 'integer',
45+
description: 'Maximum number of chats to return (1–200). Defaults to 50.',
46+
},
47+
},
48+
required: [],
49+
},
50+
annotations: {
51+
readOnlyHint: true,
52+
},
53+
};
54+
55+
export const handler = async (client: BeeperDesktop, args: Record<string, unknown> | undefined) => {
56+
const body = args as any;
57+
const response = await client.chats.list(body).asResponse();
58+
return asTextContentResult(await response.json());
59+
};
60+
61+
export default { metadata, tool, handler };

packages/mcp-server/src/tools/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import get_accounts from './accounts/get-accounts';
1111
import search_contacts from './contacts/search-contacts';
1212
import create_chats from './chats/create-chats';
1313
import get_chat from './chats/get-chat';
14+
import list_chats from './chats/list-chats';
1415
import archive_chat from './chats/archive-chat';
1516
import search_chats from './chats/search-chats';
1617
import set_chat_reminder from './chats/reminders/set-chat-reminder';
1718
import clear_chat_reminder from './chats/reminders/clear-chat-reminder';
19+
import list_messages from './messages/list-messages';
1820
import search_messages from './messages/search-messages';
1921
import send_message from './messages/send-message';
2022
import info_token from './token/info-token';
@@ -32,10 +34,12 @@ addEndpoint(get_accounts);
3234
addEndpoint(search_contacts);
3335
addEndpoint(create_chats);
3436
addEndpoint(get_chat);
37+
addEndpoint(list_chats);
3538
addEndpoint(archive_chat);
3639
addEndpoint(search_chats);
3740
addEndpoint(set_chat_reminder);
3841
addEndpoint(clear_chat_reminder);
42+
addEndpoint(list_messages);
3943
addEndpoint(search_messages);
4044
addEndpoint(send_message);
4145
addEndpoint(info_token);
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { Metadata, asTextContentResult } from '@beeper/desktop-api-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: 'messages',
10+
operation: 'read',
11+
tags: [],
12+
httpMethod: 'get',
13+
httpPath: '/v1/messages',
14+
operationId: 'listMessages',
15+
};
16+
17+
export const tool: Tool = {
18+
name: 'list_messages',
19+
description: 'List all messages in a chat with cursor-based pagination. Sorted by timestamp.',
20+
inputSchema: {
21+
type: 'object',
22+
properties: {
23+
chatID: {
24+
type: 'string',
25+
description: 'The chat ID to list messages from',
26+
},
27+
cursor: {
28+
type: 'string',
29+
description: 'Message cursor for pagination. Use with direction to navigate results.',
30+
},
31+
direction: {
32+
type: 'string',
33+
description:
34+
"Pagination direction used with 'cursor': 'before' fetches older messages, 'after' fetches newer messages. Defaults to 'before' when only 'cursor' is provided.",
35+
enum: ['after', 'before'],
36+
},
37+
limit: {
38+
type: 'integer',
39+
description: 'Maximum number of messages to return (1–500). Defaults to 50.',
40+
},
41+
},
42+
required: ['chatID'],
43+
},
44+
annotations: {
45+
readOnlyHint: true,
46+
},
47+
};
48+
49+
export const handler = async (client: BeeperDesktop, args: Record<string, unknown> | undefined) => {
50+
const body = args as any;
51+
const response = await client.messages.list(body).asResponse();
52+
return asTextContentResult(await response.json());
53+
};
54+
55+
export default { metadata, tool, handler };

src/client.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,22 @@ import {
3030
import { APIPromise } from './core/api-promise';
3131
import { Account, AccountListResponse, Accounts } from './resources/accounts';
3232
import { ContactSearchParams, ContactSearchResponse, Contacts } from './resources/contacts';
33-
import { MessageSearchParams, MessageSendParams, MessageSendResponse, Messages } from './resources/messages';
33+
import {
34+
MessageListParams,
35+
MessageSearchParams,
36+
MessageSendParams,
37+
MessageSendResponse,
38+
Messages,
39+
} from './resources/messages';
3440
import { Token, UserInfo } from './resources/token';
3541
import {
3642
Chat,
3743
ChatArchiveParams,
3844
ChatCreateParams,
3945
ChatCreateResponse,
46+
ChatListParams,
47+
ChatListResponse,
48+
ChatListResponsesCursor,
4049
ChatRetrieveParams,
4150
ChatSearchParams,
4251
Chats,
@@ -805,7 +814,7 @@ export class BeeperDesktop {
805814
static toFile = Uploads.toFile;
806815

807816
/**
808-
* Accounts operations
817+
* Manage connected chat accounts
809818
*/
810819
accounts: API.Accounts = new API.Accounts(this);
811820
/**
@@ -859,16 +868,20 @@ export declare namespace BeeperDesktop {
859868
Chats as Chats,
860869
type Chat as Chat,
861870
type ChatCreateResponse as ChatCreateResponse,
871+
type ChatListResponse as ChatListResponse,
872+
type ChatListResponsesCursor as ChatListResponsesCursor,
862873
type ChatsCursor as ChatsCursor,
863874
type ChatCreateParams as ChatCreateParams,
864875
type ChatRetrieveParams as ChatRetrieveParams,
876+
type ChatListParams as ChatListParams,
865877
type ChatArchiveParams as ChatArchiveParams,
866878
type ChatSearchParams as ChatSearchParams,
867879
};
868880

869881
export {
870882
Messages as Messages,
871883
type MessageSendResponse as MessageSendResponse,
884+
type MessageListParams as MessageListParams,
872885
type MessageSearchParams as MessageSearchParams,
873886
type MessageSendParams as MessageSendParams,
874887
};

src/resources/accounts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { APIPromise } from '../core/api-promise';
66
import { RequestOptions } from '../internal/request-options';
77

88
/**
9-
* Accounts operations
9+
* Manage connected chat accounts
1010
*/
1111
export class Accounts extends APIResource {
1212
/**

src/resources/chats/chats.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,25 @@ export class Chats extends APIResource {
5151
return this._client.get(path`/v1/chats/${chatID}`, { query, ...options });
5252
}
5353

54+
/**
55+
* List all chats sorted by last activity (most recent first). Combines all
56+
* accounts into a single paginated list.
57+
*
58+
* @example
59+
* ```ts
60+
* // Automatically fetches more pages as needed.
61+
* for await (const chatListResponse of client.chats.list()) {
62+
* // ...
63+
* }
64+
* ```
65+
*/
66+
list(
67+
query: ChatListParams | null | undefined = {},
68+
options?: RequestOptions,
69+
): PagePromise<ChatListResponsesCursor, ChatListResponse> {
70+
return this._client.getAPIList('/v1/chats', Cursor<ChatListResponse>, { query, ...options });
71+
}
72+
5473
/**
5574
* Archive or unarchive a chat. Set archived=true to move to archive,
5675
* archived=false to move back to inbox
@@ -90,6 +109,8 @@ export class Chats extends APIResource {
90109
}
91110
}
92111

112+
export type ChatListResponsesCursor = Cursor<ChatListResponse>;
113+
93114
export type ChatsCursor = Cursor<Chat>;
94115

95116
export interface Chat {
@@ -189,6 +210,13 @@ export interface ChatCreateResponse extends Shared.BaseResponse {
189210
chatID?: string;
190211
}
191212

213+
export interface ChatListResponse extends Chat {
214+
/**
215+
* Last message preview for this chat, if available.
216+
*/
217+
preview?: Shared.Message;
218+
}
219+
192220
export interface ChatCreateParams {
193221
/**
194222
* Account to create the chat on.
@@ -225,6 +253,13 @@ export interface ChatRetrieveParams {
225253
maxParticipantCount?: number | null;
226254
}
227255

256+
export interface ChatListParams extends CursorParams {
257+
/**
258+
* Limit to specific account IDs. If omitted, fetches from all accounts.
259+
*/
260+
accountIDs?: Array<string>;
261+
}
262+
228263
export interface ChatArchiveParams {
229264
/**
230265
* True to archive, false to unarchive
@@ -293,9 +328,12 @@ export declare namespace Chats {
293328
export {
294329
type Chat as Chat,
295330
type ChatCreateResponse as ChatCreateResponse,
331+
type ChatListResponse as ChatListResponse,
332+
type ChatListResponsesCursor as ChatListResponsesCursor,
296333
type ChatsCursor as ChatsCursor,
297334
type ChatCreateParams as ChatCreateParams,
298335
type ChatRetrieveParams as ChatRetrieveParams,
336+
type ChatListParams as ChatListParams,
299337
type ChatArchiveParams as ChatArchiveParams,
300338
type ChatSearchParams as ChatSearchParams,
301339
};

0 commit comments

Comments
 (0)