agentmail-toolkit 0.1.20 → 0.1.21
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/dist/ai-sdk.js +40 -51
- package/dist/ai-sdk.js.map +1 -1
- package/dist/ai-sdk.mjs +2 -2
- package/dist/chunk-GWFZG2RN.mjs +117 -0
- package/dist/chunk-GWFZG2RN.mjs.map +1 -0
- package/dist/chunk-UODX72KA.mjs +40 -0
- package/dist/chunk-UODX72KA.mjs.map +1 -0
- package/dist/index.d.mts +16 -29
- package/dist/index.d.ts +16 -29
- package/dist/index.js +40 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -3
- package/dist/langchain.js +40 -51
- package/dist/langchain.js.map +1 -1
- package/dist/langchain.mjs +2 -2
- package/dist/mcp.js +40 -51
- package/dist/mcp.js.map +1 -1
- package/dist/mcp.mjs +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
CreateInboxParams: () => CreateInboxParams,
|
|
24
|
-
GetAttachmentParams: () => GetAttachmentParams,
|
|
25
24
|
GetInboxParams: () => GetInboxParams,
|
|
26
25
|
GetMessageParams: () => GetMessageParams,
|
|
27
26
|
GetThreadParams: () => GetThreadParams,
|
|
@@ -37,52 +36,47 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
36
|
// src/schemas.ts
|
|
38
37
|
var import_zod = require("zod");
|
|
39
38
|
var ListItemsParams = import_zod.z.object({
|
|
40
|
-
limit: import_zod.z.number().optional().describe("
|
|
41
|
-
|
|
39
|
+
limit: import_zod.z.number().optional().describe("Max number of items to return"),
|
|
40
|
+
page_token: import_zod.z.string().optional().describe("Page token for pagination")
|
|
42
41
|
});
|
|
43
42
|
var GetInboxParams = import_zod.z.object({
|
|
44
|
-
inbox_id: import_zod.z.string().describe("
|
|
43
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get")
|
|
45
44
|
});
|
|
46
45
|
var CreateInboxParams = import_zod.z.object({
|
|
47
|
-
username: import_zod.z.string().optional().describe("
|
|
48
|
-
domain: import_zod.z.string().optional().describe("
|
|
49
|
-
display_name: import_zod.z.string().optional().describe("
|
|
46
|
+
username: import_zod.z.string().optional().describe("Username of inbox to create"),
|
|
47
|
+
domain: import_zod.z.string().optional().describe("Domain of inbox to create"),
|
|
48
|
+
display_name: import_zod.z.string().optional().describe("Display name of inbox to create")
|
|
50
49
|
});
|
|
51
50
|
var ListThreadsParams = ListItemsParams.extend({
|
|
52
|
-
inbox_id: import_zod.z.string().describe("
|
|
53
|
-
labels: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
51
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to list threads from"),
|
|
52
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("Labels to filter threads by")
|
|
54
53
|
});
|
|
55
54
|
var GetThreadParams = import_zod.z.object({
|
|
56
|
-
inbox_id: import_zod.z.string().describe("
|
|
57
|
-
thread_id: import_zod.z.string().describe("
|
|
55
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get thread from"),
|
|
56
|
+
thread_id: import_zod.z.string().describe("ID of thread to get")
|
|
58
57
|
});
|
|
59
58
|
var ListMessagesParams = ListItemsParams.extend({
|
|
60
|
-
inbox_id: import_zod.z.string().describe("
|
|
61
|
-
labels: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
59
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to list messages from"),
|
|
60
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("Labels to filter messages by")
|
|
62
61
|
});
|
|
63
62
|
var GetMessageParams = import_zod.z.object({
|
|
64
|
-
inbox_id: import_zod.z.string().describe("
|
|
65
|
-
message_id: import_zod.z.string().describe("
|
|
66
|
-
});
|
|
67
|
-
var GetAttachmentParams = import_zod.z.object({
|
|
68
|
-
inbox_id: import_zod.z.string().describe("The ID of the inbox to get the attachment for"),
|
|
69
|
-
message_id: import_zod.z.string().describe("The ID of the message to get the attachment for"),
|
|
70
|
-
attachment_id: import_zod.z.string().describe("The ID of the attachment to get")
|
|
63
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get message from"),
|
|
64
|
+
message_id: import_zod.z.string().describe("ID of message to get")
|
|
71
65
|
});
|
|
72
66
|
var SendMessageParams = import_zod.z.object({
|
|
73
|
-
inbox_id: import_zod.z.string().describe("
|
|
74
|
-
to: import_zod.z.array(import_zod.z.string()).describe("
|
|
75
|
-
cc: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
76
|
-
bcc: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
77
|
-
subject: import_zod.z.string().optional().describe("
|
|
78
|
-
text: import_zod.z.string().optional().describe("
|
|
79
|
-
html: import_zod.z.string().optional().describe("
|
|
67
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to send message from"),
|
|
68
|
+
to: import_zod.z.array(import_zod.z.string()).describe("Recipients of message"),
|
|
69
|
+
cc: import_zod.z.array(import_zod.z.string()).optional().describe("CC recipients of message"),
|
|
70
|
+
bcc: import_zod.z.array(import_zod.z.string()).optional().describe("BCC recipients of message"),
|
|
71
|
+
subject: import_zod.z.string().optional().describe("Subject of message"),
|
|
72
|
+
text: import_zod.z.string().optional().describe("Plain text body of message"),
|
|
73
|
+
html: import_zod.z.string().optional().describe("HTML body of message")
|
|
80
74
|
});
|
|
81
75
|
var ReplyToMessageParams = import_zod.z.object({
|
|
82
|
-
inbox_id: import_zod.z.string().describe("
|
|
83
|
-
message_id: import_zod.z.string().describe("
|
|
84
|
-
text: import_zod.z.string().optional().describe("
|
|
85
|
-
html: import_zod.z.string().optional().describe("
|
|
76
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to reply to message from"),
|
|
77
|
+
message_id: import_zod.z.string().describe("ID of message to reply to"),
|
|
78
|
+
text: import_zod.z.string().optional().describe("Plain text body of reply"),
|
|
79
|
+
html: import_zod.z.string().optional().describe("HTML body of reply")
|
|
86
80
|
});
|
|
87
81
|
|
|
88
82
|
// src/tools.ts
|
|
@@ -90,68 +84,61 @@ var tools = [
|
|
|
90
84
|
{
|
|
91
85
|
name: "list_inboxes",
|
|
92
86
|
method: "inboxes.list",
|
|
93
|
-
description: "List
|
|
87
|
+
description: "List inboxes",
|
|
94
88
|
schema: ListItemsParams
|
|
95
89
|
},
|
|
96
90
|
{
|
|
97
91
|
name: "get_inbox",
|
|
98
92
|
method: "inboxes.get",
|
|
99
|
-
description: "Get
|
|
93
|
+
description: "Get inbox",
|
|
100
94
|
schema: GetInboxParams
|
|
101
95
|
},
|
|
102
96
|
{
|
|
103
97
|
name: "create_inbox",
|
|
104
98
|
method: "inboxes.create",
|
|
105
|
-
description: "Create
|
|
99
|
+
description: "Create inbox. Use default username, domain, and display name unless otherwise specified.",
|
|
106
100
|
schema: CreateInboxParams
|
|
107
101
|
},
|
|
108
102
|
{
|
|
109
103
|
name: "list_threads",
|
|
110
|
-
method: "threads.list",
|
|
111
|
-
description: "List
|
|
104
|
+
method: "inboxes.threads.list",
|
|
105
|
+
description: "List threads in inbox",
|
|
112
106
|
schema: ListThreadsParams
|
|
113
107
|
},
|
|
114
108
|
{
|
|
115
109
|
name: "get_thread",
|
|
116
|
-
method: "threads.get",
|
|
117
|
-
description: "Get
|
|
110
|
+
method: "inboxes.threads.get",
|
|
111
|
+
description: "Get thread",
|
|
118
112
|
schema: GetThreadParams
|
|
119
113
|
},
|
|
120
114
|
{
|
|
121
115
|
name: "list_messages",
|
|
122
|
-
method: "messages.list",
|
|
123
|
-
description: "List
|
|
116
|
+
method: "inboxes.messages.list",
|
|
117
|
+
description: "List messages in inbox",
|
|
124
118
|
schema: ListMessagesParams
|
|
125
119
|
},
|
|
126
120
|
{
|
|
127
121
|
name: "get_message",
|
|
128
|
-
method: "messages.get",
|
|
129
|
-
description: "Get
|
|
122
|
+
method: "inboxes.messages.get",
|
|
123
|
+
description: "Get message",
|
|
130
124
|
schema: GetMessageParams
|
|
131
125
|
},
|
|
132
|
-
{
|
|
133
|
-
name: "get_attachment",
|
|
134
|
-
method: "attachments.get",
|
|
135
|
-
description: "Get an attachment by ID",
|
|
136
|
-
schema: GetAttachmentParams
|
|
137
|
-
},
|
|
138
126
|
{
|
|
139
127
|
name: "send_message",
|
|
140
|
-
method: "messages.send",
|
|
141
|
-
description: "Send
|
|
128
|
+
method: "inboxes.messages.send",
|
|
129
|
+
description: "Send message",
|
|
142
130
|
schema: SendMessageParams
|
|
143
131
|
},
|
|
144
132
|
{
|
|
145
133
|
name: "reply_to_message",
|
|
146
|
-
method: "messages.reply",
|
|
147
|
-
description: "Reply to
|
|
134
|
+
method: "inboxes.messages.reply",
|
|
135
|
+
description: "Reply to message",
|
|
148
136
|
schema: ReplyToMessageParams
|
|
149
137
|
}
|
|
150
138
|
];
|
|
151
139
|
// Annotate the CommonJS export names for ESM import in node:
|
|
152
140
|
0 && (module.exports = {
|
|
153
141
|
CreateInboxParams,
|
|
154
|
-
GetAttachmentParams,
|
|
155
142
|
GetInboxParams,
|
|
156
143
|
GetMessageParams,
|
|
157
144
|
GetThreadParams,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["export * from './schemas'\nexport * from './tools'\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["export * from './schemas'\nexport * from './tools'\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('Max number of items to return'),\n page_token: z.string().optional().describe('Page token for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('ID of inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('Username of inbox to create'),\n domain: z.string().optional().describe('Domain of inbox to create'),\n display_name: z.string().optional().describe('Display name of inbox to create'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('ID of inbox to list threads from'),\n labels: z.array(z.string()).optional().describe('Labels to filter threads by'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('ID of inbox to get thread from'),\n thread_id: z.string().describe('ID of thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('ID of inbox to list messages from'),\n labels: z.array(z.string()).optional().describe('Labels to filter messages by'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('ID of inbox to get message from'),\n message_id: z.string().describe('ID of message to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('ID of inbox to send message from'),\n to: z.array(z.string()).describe('Recipients of message'),\n cc: z.array(z.string()).optional().describe('CC recipients of message'),\n bcc: z.array(z.string()).optional().describe('BCC recipients of message'),\n subject: z.string().optional().describe('Subject of message'),\n text: z.string().optional().describe('Plain text body of message'),\n html: z.string().optional().describe('HTML body of message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('ID of inbox to reply to message from'),\n message_id: z.string().describe('ID of message to reply to'),\n text: z.string().optional().describe('Plain text body of reply'),\n html: z.string().optional().describe('HTML body of reply'),\n})\n","import { AnyZodObject } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n method: string\n description: string\n schema: AnyZodObject\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n method: 'inboxes.list',\n description: 'List inboxes',\n schema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n method: 'inboxes.get',\n description: 'Get inbox',\n schema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n method: 'inboxes.create',\n description: 'Create inbox. Use default username, domain, and display name unless otherwise specified.',\n schema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n method: 'inboxes.threads.list',\n description: 'List threads in inbox',\n schema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n method: 'inboxes.threads.get',\n description: 'Get thread',\n schema: GetThreadParams,\n },\n {\n name: 'list_messages',\n method: 'inboxes.messages.list',\n description: 'List messages in inbox',\n schema: ListMessagesParams,\n },\n {\n name: 'get_message',\n method: 'inboxes.messages.get',\n description: 'Get message',\n schema: GetMessageParams,\n },\n {\n name: 'send_message',\n method: 'inboxes.messages.send',\n description: 'Send message',\n schema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n method: 'inboxes.messages.reply',\n description: 'Reply to message',\n schema: ReplyToMessageParams,\n },\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAEX,IAAM,kBAAkB,aAAE,OAAO;AAAA,EACpC,OAAO,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,+BAA+B;AAAA,EACrE,YAAY,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,2BAA2B;AAC1E,CAAC;AAEM,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACnC,UAAU,aAAE,OAAO,EAAE,SAAS,oBAAoB;AACtD,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACtC,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,6BAA6B;AAAA,EACtE,QAAQ,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,2BAA2B;AAAA,EAClE,cAAc,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,iCAAiC;AAClF,CAAC;AAEM,IAAM,oBAAoB,gBAAgB,OAAO;AAAA,EACpD,UAAU,aAAE,OAAO,EAAE,SAAS,kCAAkC;AAAA,EAChE,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AO,EAAE,SAAS,EAAE,SAAS,0BAA0B;AAAA,EAC/D,MAAM,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oBAAoB;AAC7D,CAAC;;;AC/BM,IAAM,QAAgB;AAAA,EACzB;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AACJ;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CreateInboxParams,
|
|
3
|
-
GetAttachmentParams,
|
|
4
3
|
GetInboxParams,
|
|
5
4
|
GetMessageParams,
|
|
6
5
|
GetThreadParams,
|
|
@@ -10,10 +9,9 @@ import {
|
|
|
10
9
|
ReplyToMessageParams,
|
|
11
10
|
SendMessageParams,
|
|
12
11
|
tools
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GWFZG2RN.mjs";
|
|
14
13
|
export {
|
|
15
14
|
CreateInboxParams,
|
|
16
|
-
GetAttachmentParams,
|
|
17
15
|
GetInboxParams,
|
|
18
16
|
GetMessageParams,
|
|
19
17
|
GetThreadParams,
|
package/dist/langchain.js
CHANGED
|
@@ -55,52 +55,47 @@ var Wrapper = class {
|
|
|
55
55
|
// src/schemas.ts
|
|
56
56
|
var import_zod = require("zod");
|
|
57
57
|
var ListItemsParams = import_zod.z.object({
|
|
58
|
-
limit: import_zod.z.number().optional().describe("
|
|
59
|
-
|
|
58
|
+
limit: import_zod.z.number().optional().describe("Max number of items to return"),
|
|
59
|
+
page_token: import_zod.z.string().optional().describe("Page token for pagination")
|
|
60
60
|
});
|
|
61
61
|
var GetInboxParams = import_zod.z.object({
|
|
62
|
-
inbox_id: import_zod.z.string().describe("
|
|
62
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get")
|
|
63
63
|
});
|
|
64
64
|
var CreateInboxParams = import_zod.z.object({
|
|
65
|
-
username: import_zod.z.string().optional().describe("
|
|
66
|
-
domain: import_zod.z.string().optional().describe("
|
|
67
|
-
display_name: import_zod.z.string().optional().describe("
|
|
65
|
+
username: import_zod.z.string().optional().describe("Username of inbox to create"),
|
|
66
|
+
domain: import_zod.z.string().optional().describe("Domain of inbox to create"),
|
|
67
|
+
display_name: import_zod.z.string().optional().describe("Display name of inbox to create")
|
|
68
68
|
});
|
|
69
69
|
var ListThreadsParams = ListItemsParams.extend({
|
|
70
|
-
inbox_id: import_zod.z.string().describe("
|
|
71
|
-
labels: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
70
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to list threads from"),
|
|
71
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("Labels to filter threads by")
|
|
72
72
|
});
|
|
73
73
|
var GetThreadParams = import_zod.z.object({
|
|
74
|
-
inbox_id: import_zod.z.string().describe("
|
|
75
|
-
thread_id: import_zod.z.string().describe("
|
|
74
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get thread from"),
|
|
75
|
+
thread_id: import_zod.z.string().describe("ID of thread to get")
|
|
76
76
|
});
|
|
77
77
|
var ListMessagesParams = ListItemsParams.extend({
|
|
78
|
-
inbox_id: import_zod.z.string().describe("
|
|
79
|
-
labels: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
78
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to list messages from"),
|
|
79
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("Labels to filter messages by")
|
|
80
80
|
});
|
|
81
81
|
var GetMessageParams = import_zod.z.object({
|
|
82
|
-
inbox_id: import_zod.z.string().describe("
|
|
83
|
-
message_id: import_zod.z.string().describe("
|
|
84
|
-
});
|
|
85
|
-
var GetAttachmentParams = import_zod.z.object({
|
|
86
|
-
inbox_id: import_zod.z.string().describe("The ID of the inbox to get the attachment for"),
|
|
87
|
-
message_id: import_zod.z.string().describe("The ID of the message to get the attachment for"),
|
|
88
|
-
attachment_id: import_zod.z.string().describe("The ID of the attachment to get")
|
|
82
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get message from"),
|
|
83
|
+
message_id: import_zod.z.string().describe("ID of message to get")
|
|
89
84
|
});
|
|
90
85
|
var SendMessageParams = import_zod.z.object({
|
|
91
|
-
inbox_id: import_zod.z.string().describe("
|
|
92
|
-
to: import_zod.z.array(import_zod.z.string()).describe("
|
|
93
|
-
cc: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
94
|
-
bcc: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
95
|
-
subject: import_zod.z.string().optional().describe("
|
|
96
|
-
text: import_zod.z.string().optional().describe("
|
|
97
|
-
html: import_zod.z.string().optional().describe("
|
|
86
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to send message from"),
|
|
87
|
+
to: import_zod.z.array(import_zod.z.string()).describe("Recipients of message"),
|
|
88
|
+
cc: import_zod.z.array(import_zod.z.string()).optional().describe("CC recipients of message"),
|
|
89
|
+
bcc: import_zod.z.array(import_zod.z.string()).optional().describe("BCC recipients of message"),
|
|
90
|
+
subject: import_zod.z.string().optional().describe("Subject of message"),
|
|
91
|
+
text: import_zod.z.string().optional().describe("Plain text body of message"),
|
|
92
|
+
html: import_zod.z.string().optional().describe("HTML body of message")
|
|
98
93
|
});
|
|
99
94
|
var ReplyToMessageParams = import_zod.z.object({
|
|
100
|
-
inbox_id: import_zod.z.string().describe("
|
|
101
|
-
message_id: import_zod.z.string().describe("
|
|
102
|
-
text: import_zod.z.string().optional().describe("
|
|
103
|
-
html: import_zod.z.string().optional().describe("
|
|
95
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to reply to message from"),
|
|
96
|
+
message_id: import_zod.z.string().describe("ID of message to reply to"),
|
|
97
|
+
text: import_zod.z.string().optional().describe("Plain text body of reply"),
|
|
98
|
+
html: import_zod.z.string().optional().describe("HTML body of reply")
|
|
104
99
|
});
|
|
105
100
|
|
|
106
101
|
// src/tools.ts
|
|
@@ -108,61 +103,55 @@ var tools = [
|
|
|
108
103
|
{
|
|
109
104
|
name: "list_inboxes",
|
|
110
105
|
method: "inboxes.list",
|
|
111
|
-
description: "List
|
|
106
|
+
description: "List inboxes",
|
|
112
107
|
schema: ListItemsParams
|
|
113
108
|
},
|
|
114
109
|
{
|
|
115
110
|
name: "get_inbox",
|
|
116
111
|
method: "inboxes.get",
|
|
117
|
-
description: "Get
|
|
112
|
+
description: "Get inbox",
|
|
118
113
|
schema: GetInboxParams
|
|
119
114
|
},
|
|
120
115
|
{
|
|
121
116
|
name: "create_inbox",
|
|
122
117
|
method: "inboxes.create",
|
|
123
|
-
description: "Create
|
|
118
|
+
description: "Create inbox. Use default username, domain, and display name unless otherwise specified.",
|
|
124
119
|
schema: CreateInboxParams
|
|
125
120
|
},
|
|
126
121
|
{
|
|
127
122
|
name: "list_threads",
|
|
128
|
-
method: "threads.list",
|
|
129
|
-
description: "List
|
|
123
|
+
method: "inboxes.threads.list",
|
|
124
|
+
description: "List threads in inbox",
|
|
130
125
|
schema: ListThreadsParams
|
|
131
126
|
},
|
|
132
127
|
{
|
|
133
128
|
name: "get_thread",
|
|
134
|
-
method: "threads.get",
|
|
135
|
-
description: "Get
|
|
129
|
+
method: "inboxes.threads.get",
|
|
130
|
+
description: "Get thread",
|
|
136
131
|
schema: GetThreadParams
|
|
137
132
|
},
|
|
138
133
|
{
|
|
139
134
|
name: "list_messages",
|
|
140
|
-
method: "messages.list",
|
|
141
|
-
description: "List
|
|
135
|
+
method: "inboxes.messages.list",
|
|
136
|
+
description: "List messages in inbox",
|
|
142
137
|
schema: ListMessagesParams
|
|
143
138
|
},
|
|
144
139
|
{
|
|
145
140
|
name: "get_message",
|
|
146
|
-
method: "messages.get",
|
|
147
|
-
description: "Get
|
|
141
|
+
method: "inboxes.messages.get",
|
|
142
|
+
description: "Get message",
|
|
148
143
|
schema: GetMessageParams
|
|
149
144
|
},
|
|
150
|
-
{
|
|
151
|
-
name: "get_attachment",
|
|
152
|
-
method: "attachments.get",
|
|
153
|
-
description: "Get an attachment by ID",
|
|
154
|
-
schema: GetAttachmentParams
|
|
155
|
-
},
|
|
156
145
|
{
|
|
157
146
|
name: "send_message",
|
|
158
|
-
method: "messages.send",
|
|
159
|
-
description: "Send
|
|
147
|
+
method: "inboxes.messages.send",
|
|
148
|
+
description: "Send message",
|
|
160
149
|
schema: SendMessageParams
|
|
161
150
|
},
|
|
162
151
|
{
|
|
163
152
|
name: "reply_to_message",
|
|
164
|
-
method: "messages.reply",
|
|
165
|
-
description: "Reply to
|
|
153
|
+
method: "inboxes.messages.reply",
|
|
154
|
+
description: "Reply to message",
|
|
166
155
|
schema: ReplyToMessageParams
|
|
167
156
|
}
|
|
168
157
|
];
|
package/dist/langchain.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/langchain.ts","../src/wrapper.ts","../src/schemas.ts","../src/tools.ts","../src/toolkit.ts"],"sourcesContent":["import { type StructuredTool, tool as langchainTool } from '@langchain/core/tools'\nimport { AgentMailClient } from 'agentmail'\n\nimport { ListToolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends ListToolkit<StructuredTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): StructuredTool {\n return langchainTool(async (args) => JSON.stringify((await this.safeCall(tool.method, args)).result, null, 2), {\n name: tool.name,\n description: tool.description,\n schema: tool.schema,\n })\n }\n}\n","import { AgentMailClient } from 'agentmail'\n\nexport class Wrapper {\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n }\n\n public async call(method: string, args: any) {\n const parts = method.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n const { inboxId, ...options } = args\n\n if (inboxId) return await parent[methodKey].call(parent, inboxId, options)\n else return await parent[methodKey].call(parent, options)\n }\n\n public async safeCall(method: string, args: any) {\n try {\n return { isError: false, result: await this.call(method, args) }\n } catch (error) {\n if (error instanceof Error) return { isError: true, result: error.message }\n else return { isError: true, result: 'Unknown error' }\n }\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('The maximum number of items to return'),\n last_key: z.string().optional().describe('The last key to use for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('The username of the inbox to create'),\n domain: z.string().optional().describe('The domain of the inbox to create'),\n display_name: z.string().optional().describe('The display name of the inbox to create'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list threads for'),\n labels: z.array(z.string()).optional().describe('The labels to filter threads by'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the thread for'),\n thread_id: z.string().describe('The ID of the thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list messages for'),\n labels: z.array(z.string()).optional().describe('The labels to filter messages by'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the message for'),\n message_id: z.string().describe('The ID of the message to get'),\n})\n\nexport const GetAttachmentParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),\n message_id: z.string().describe('The ID of the message to get the attachment for'),\n attachment_id: z.string().describe('The ID of the attachment to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to send the message from'),\n to: z.array(z.string()).describe('The list of recipients'),\n cc: z.array(z.string()).optional().describe('The list of CC recipients'),\n bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),\n subject: z.string().optional().describe('The subject of the message'),\n text: z.string().optional().describe('The plain text body of the message'),\n html: z.string().optional().describe('The HTML body of the message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('The inbox ID of the inbox to reply to the message from'),\n message_id: z.string().describe('The message ID of the message you wish to reply to'),\n text: z.string().optional().describe('The plain text body of the reply'),\n html: z.string().optional().describe('The HTML body of the reply'),\n})\n","import { AnyZodObject } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n GetAttachmentParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n method: string\n description: string\n schema: AnyZodObject\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n method: 'inboxes.list',\n description: 'List all inboxes',\n schema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n method: 'inboxes.get',\n description: 'Get an inbox by ID',\n schema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n method: 'inboxes.create',\n description: 'Create a new inbox',\n schema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n method: 'threads.list',\n description: 'List all threads',\n schema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n method: 'threads.get',\n description: 'Get a thread by ID',\n schema: GetThreadParams,\n },\n {\n name: 'list_messages',\n method: 'messages.list',\n description: 'List all messages',\n schema: ListMessagesParams,\n },\n {\n name: 'get_message',\n method: 'messages.get',\n description: 'Get a message by ID',\n schema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n method: 'attachments.get',\n description: 'Get an attachment by ID',\n schema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n method: 'messages.send',\n description: 'Send a message',\n schema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n method: 'messages.reply',\n description: 'Reply to a message',\n schema: ReplyToMessageParams,\n },\n]\n","import { AgentMailClient } from 'agentmail'\n\nimport { Wrapper } from './wrapper'\nimport { type Tool, tools } from './tools'\n\nexport abstract class ListToolkit<T> extends Wrapper {\n protected readonly tools: T[] = []\n\n constructor(client?: AgentMailClient) {\n super(client)\n\n this.tools = tools.map((tool) => this.buildTool(tool))\n }\n\n protected abstract buildTool(tool: Tool): T\n\n public getTools() {\n return this.tools\n }\n}\n\nexport abstract class MapToolkit<T> extends Wrapper {\n protected readonly tools: Record<string, T> = {}\n\n constructor(client?: AgentMailClient) {\n super(client)\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n public getTools() {\n return this.tools\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA2D;;;ACA3D,uBAAgC;AAEzB,IAAM,UAAN,MAAc;AAAA,EACjB,YAA6B,QAA0B;AAA1B;AACzB,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,iCAAgB;AAAA,EACxD;AAAA,EAEA,MAAa,KAAK,QAAg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A,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AACJ;;;AC9EO,IAAe,cAAf,cAAsC,QAAQ;AAAA,EAC9B,QAAa,CAAC;AAAA,EAEjC,YAAY,QAA0B;AAClC,UAAM,MAAM;AAEZ,SAAK,QAAQ,MAAM,IAAI,CAAC,SAAS,KAAK,UAAU,IAAI,CAAC;AAAA,EACzD;AAAA,EAIO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;;;AJbO,IAAM,mBAAN,cAA+B,YAA4B;AAAA,EAC9D,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAA4B;AAC5C,eAAO,cAAAC,MAAc,OAAO,SAAS,KAAK,WAAW,MAAM,KAAK,SAAS,KAAK,QAAQ,IAAI,GAAG,QAAQ,MAAM,CAAC,GAAG;AAAA,MAC3G,MAAM,KAAK;AAAA,MACX,aAAa,KAAK;AAAA,MAClB,QAAQ,KAAK;AAAA,IACjB,CAAC;AAAA,EACL;AACJ;","names":["import_tools","langchainTool"]}
|
|
1
|
+
{"version":3,"sources":["../src/langchain.ts","../src/wrapper.ts","../src/schemas.ts","../src/tools.ts","../src/toolkit.ts"],"sourcesContent":["import { type StructuredTool, tool as langchainTool } from '@langchain/core/tools'\nimport { AgentMailClient } from 'agentmail'\n\nimport { ListToolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends ListToolkit<StructuredTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): StructuredTool {\n return langchainTool(async (args) => JSON.stringify((await this.safeCall(tool.method, args)).result, null, 2), {\n name: tool.name,\n description: tool.description,\n schema: tool.schema,\n })\n }\n}\n","import { AgentMailClient } from 'agentmail'\n\nexport class Wrapper {\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n }\n\n public async call(method: string, args: any) {\n const parts = method.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n const { inboxId, ...options } = args\n\n if (inboxId) return await parent[methodKey].call(parent, inboxId, options)\n else return await parent[methodKey].call(parent, options)\n }\n\n public async safeCall(method: string, args: any) {\n try {\n return { isError: false, result: await this.call(method, args) }\n } catch (error) {\n if (error instanceof Error) return { isError: true, result: error.message }\n else return { isError: true, result: 'Unknown error' }\n }\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('Max number of items to return'),\n page_token: z.string().optional().describe('Page token for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('ID of inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('Username of inbox to create'),\n domain: z.string().optional().describe('Domain of inbox to create'),\n display_name: z.string().optional().describe('Display name of inbox to create'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('ID of inbox to list threads from'),\n labels: z.array(z.string()).optional().describe('Labels to filter threads by'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('ID of inbox to get thread from'),\n thread_id: z.string().describe('ID of thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('ID of inbox to list messages from'),\n labels: z.array(z.string()).optional().describe('Labels to filter messages by'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('ID of inbox to get message from'),\n message_id: z.string().describe('ID of message to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('ID of inbox to send message from'),\n to: z.array(z.string()).describe('Recipients of message'),\n cc: z.array(z.string()).optional().describe('CC recipients of message'),\n bcc: z.array(z.string()).optional().describe('BCC recipients of message'),\n subject: z.string().optional().describe('Subject of message'),\n text: z.string().optional().describe('Plain text body of message'),\n html: z.string().optional().describe('HTML body of message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('ID of inbox to reply to message from'),\n message_id: z.string().describe('ID of message to reply to'),\n text: z.string().optional().describe('Plain text body of reply'),\n html: z.string().optional().describe('HTML body of reply'),\n})\n","import { AnyZodObject } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n method: string\n description: string\n schema: AnyZodObject\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n method: 'inboxes.list',\n description: 'List inboxes',\n schema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n method: 'inboxes.get',\n description: 'Get inbox',\n schema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n method: 'inboxes.create',\n description: 'Create inbox. Use default username, domain, and display name unless otherwise specified.',\n schema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n method: 'inboxes.threads.list',\n description: 'List threads in inbox',\n schema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n method: 'inboxes.threads.get',\n description: 'Get thread',\n schema: GetThreadParams,\n },\n {\n name: 'list_messages',\n method: 'inboxes.messages.list',\n description: 'List messages in inbox',\n schema: ListMessagesParams,\n },\n {\n name: 'get_message',\n method: 'inboxes.messages.get',\n description: 'Get message',\n schema: GetMessageParams,\n },\n {\n name: 'send_message',\n method: 'inboxes.messages.send',\n description: 'Send message',\n schema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n method: 'inboxes.messages.reply',\n description: 'Reply to message',\n schema: ReplyToMessageParams,\n },\n]\n","import { AgentMailClient } from 'agentmail'\n\nimport { Wrapper } from './wrapper'\nimport { type Tool, tools } from './tools'\n\nexport abstract class ListToolkit<T> extends Wrapper {\n protected readonly tools: T[] = []\n\n constructor(client?: AgentMailClient) {\n super(client)\n\n this.tools = tools.map((tool) => this.buildTool(tool))\n }\n\n protected abstract buildTool(tool: Tool): T\n\n public getTools() {\n return this.tools\n }\n}\n\nexport abstract class MapToolkit<T> extends Wrapper {\n protected readonly tools: Record<string, T> = {}\n\n constructor(client?: AgentMailClient) {\n super(client)\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n public getTools() {\n return this.tools\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA2D;;;ACA3D,uBAAgC;AAEzB,IAAM,UAAN,MAAc;AAAA,EACjB,YAA6B,QAA0B;AAA1B;AACzB,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,iCAAgB;AAAA,EACxD;AAAA,EAEA,MAAa,KAAK,QAAgB,MAAW;AACzC,UAAM,QAAQ,OAAO,MAAM,GAAG;AAC9B,UAAM,YAAY,MAAM,IAAI;AAE5B,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,mBAAmB;AAEnD,QAAI,SAAc,KAAK;AACvB,eAAW,QAAQ,MAAO,UAAS,OAAO,IAAI;AAE9C,UAAM,EAAE,SAAS,GAAG,QAAQ,IAAI;AAEhC,QAAI,QAAS,QAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,SAAS,OAAO;AAAA,QACpE,QAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,OAAO;AAAA,EAC5D;AAAA,EAEA,MAAa,SAAS,QAAgB,MAAW;AAC7C,QAAI;AACA,aAAO,EAAE,SAAS,OAAO,QAAQ,MAAM,KAAK,KAAK,QAAQ,IAAI,EAAE;AAAA,IACnE,SAAS,OAAO;AACZ,UAAI,iBAAiB,MAAO,QAAO,EAAE,SAAS,MAAM,QAAQ,MAAM,QAAQ;AAAA,UACrE,QAAO,EAAE,SAAS,MAAM,QAAQ,gBAAgB;AAAA,IACzD;AAAA,EACJ;AACJ;;;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I,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AACJ;;;ACvEO,IAAe,cAAf,cAAsC,QAAQ;AAAA,EAC9B,QAAa,CAAC;AAAA,EAEjC,YAAY,QAA0B;AAClC,UAAM,MAAM;AAEZ,SAAK,QAAQ,MAAM,IAAI,CAAC,SAAS,KAAK,UAAU,IAAI,CAAC;AAAA,EACzD;AAAA,EAIO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;;;AJbO,IAAM,mBAAN,cAA+B,YAA4B;AAAA,EAC9D,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAA4B;AAC5C,eAAO,cAAAC,MAAc,OAAO,SAAS,KAAK,WAAW,MAAM,KAAK,SAAS,KAAK,QAAQ,IAAI,GAAG,QAAQ,MAAM,CAAC,GAAG;AAAA,MAC3G,MAAM,KAAK;AAAA,MACX,aAAa,KAAK;AAAA,MAClB,QAAQ,KAAK;AAAA,IACjB,CAAC;AAAA,EACL;AACJ;","names":["import_tools","langchainTool"]}
|
package/dist/langchain.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ListToolkit
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UODX72KA.mjs";
|
|
4
4
|
import "./chunk-XAJA2AYA.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-GWFZG2RN.mjs";
|
|
6
6
|
|
|
7
7
|
// src/langchain.ts
|
|
8
8
|
import { tool as langchainTool } from "@langchain/core/tools";
|
package/dist/mcp.js
CHANGED
|
@@ -55,52 +55,47 @@ var Wrapper = class {
|
|
|
55
55
|
// src/schemas.ts
|
|
56
56
|
var import_zod = require("zod");
|
|
57
57
|
var ListItemsParams = import_zod.z.object({
|
|
58
|
-
limit: import_zod.z.number().optional().describe("
|
|
59
|
-
|
|
58
|
+
limit: import_zod.z.number().optional().describe("Max number of items to return"),
|
|
59
|
+
page_token: import_zod.z.string().optional().describe("Page token for pagination")
|
|
60
60
|
});
|
|
61
61
|
var GetInboxParams = import_zod.z.object({
|
|
62
|
-
inbox_id: import_zod.z.string().describe("
|
|
62
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get")
|
|
63
63
|
});
|
|
64
64
|
var CreateInboxParams = import_zod.z.object({
|
|
65
|
-
username: import_zod.z.string().optional().describe("
|
|
66
|
-
domain: import_zod.z.string().optional().describe("
|
|
67
|
-
display_name: import_zod.z.string().optional().describe("
|
|
65
|
+
username: import_zod.z.string().optional().describe("Username of inbox to create"),
|
|
66
|
+
domain: import_zod.z.string().optional().describe("Domain of inbox to create"),
|
|
67
|
+
display_name: import_zod.z.string().optional().describe("Display name of inbox to create")
|
|
68
68
|
});
|
|
69
69
|
var ListThreadsParams = ListItemsParams.extend({
|
|
70
|
-
inbox_id: import_zod.z.string().describe("
|
|
71
|
-
labels: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
70
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to list threads from"),
|
|
71
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("Labels to filter threads by")
|
|
72
72
|
});
|
|
73
73
|
var GetThreadParams = import_zod.z.object({
|
|
74
|
-
inbox_id: import_zod.z.string().describe("
|
|
75
|
-
thread_id: import_zod.z.string().describe("
|
|
74
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get thread from"),
|
|
75
|
+
thread_id: import_zod.z.string().describe("ID of thread to get")
|
|
76
76
|
});
|
|
77
77
|
var ListMessagesParams = ListItemsParams.extend({
|
|
78
|
-
inbox_id: import_zod.z.string().describe("
|
|
79
|
-
labels: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
78
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to list messages from"),
|
|
79
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("Labels to filter messages by")
|
|
80
80
|
});
|
|
81
81
|
var GetMessageParams = import_zod.z.object({
|
|
82
|
-
inbox_id: import_zod.z.string().describe("
|
|
83
|
-
message_id: import_zod.z.string().describe("
|
|
84
|
-
});
|
|
85
|
-
var GetAttachmentParams = import_zod.z.object({
|
|
86
|
-
inbox_id: import_zod.z.string().describe("The ID of the inbox to get the attachment for"),
|
|
87
|
-
message_id: import_zod.z.string().describe("The ID of the message to get the attachment for"),
|
|
88
|
-
attachment_id: import_zod.z.string().describe("The ID of the attachment to get")
|
|
82
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to get message from"),
|
|
83
|
+
message_id: import_zod.z.string().describe("ID of message to get")
|
|
89
84
|
});
|
|
90
85
|
var SendMessageParams = import_zod.z.object({
|
|
91
|
-
inbox_id: import_zod.z.string().describe("
|
|
92
|
-
to: import_zod.z.array(import_zod.z.string()).describe("
|
|
93
|
-
cc: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
94
|
-
bcc: import_zod.z.array(import_zod.z.string()).optional().describe("
|
|
95
|
-
subject: import_zod.z.string().optional().describe("
|
|
96
|
-
text: import_zod.z.string().optional().describe("
|
|
97
|
-
html: import_zod.z.string().optional().describe("
|
|
86
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to send message from"),
|
|
87
|
+
to: import_zod.z.array(import_zod.z.string()).describe("Recipients of message"),
|
|
88
|
+
cc: import_zod.z.array(import_zod.z.string()).optional().describe("CC recipients of message"),
|
|
89
|
+
bcc: import_zod.z.array(import_zod.z.string()).optional().describe("BCC recipients of message"),
|
|
90
|
+
subject: import_zod.z.string().optional().describe("Subject of message"),
|
|
91
|
+
text: import_zod.z.string().optional().describe("Plain text body of message"),
|
|
92
|
+
html: import_zod.z.string().optional().describe("HTML body of message")
|
|
98
93
|
});
|
|
99
94
|
var ReplyToMessageParams = import_zod.z.object({
|
|
100
|
-
inbox_id: import_zod.z.string().describe("
|
|
101
|
-
message_id: import_zod.z.string().describe("
|
|
102
|
-
text: import_zod.z.string().optional().describe("
|
|
103
|
-
html: import_zod.z.string().optional().describe("
|
|
95
|
+
inbox_id: import_zod.z.string().describe("ID of inbox to reply to message from"),
|
|
96
|
+
message_id: import_zod.z.string().describe("ID of message to reply to"),
|
|
97
|
+
text: import_zod.z.string().optional().describe("Plain text body of reply"),
|
|
98
|
+
html: import_zod.z.string().optional().describe("HTML body of reply")
|
|
104
99
|
});
|
|
105
100
|
|
|
106
101
|
// src/tools.ts
|
|
@@ -108,61 +103,55 @@ var tools = [
|
|
|
108
103
|
{
|
|
109
104
|
name: "list_inboxes",
|
|
110
105
|
method: "inboxes.list",
|
|
111
|
-
description: "List
|
|
106
|
+
description: "List inboxes",
|
|
112
107
|
schema: ListItemsParams
|
|
113
108
|
},
|
|
114
109
|
{
|
|
115
110
|
name: "get_inbox",
|
|
116
111
|
method: "inboxes.get",
|
|
117
|
-
description: "Get
|
|
112
|
+
description: "Get inbox",
|
|
118
113
|
schema: GetInboxParams
|
|
119
114
|
},
|
|
120
115
|
{
|
|
121
116
|
name: "create_inbox",
|
|
122
117
|
method: "inboxes.create",
|
|
123
|
-
description: "Create
|
|
118
|
+
description: "Create inbox. Use default username, domain, and display name unless otherwise specified.",
|
|
124
119
|
schema: CreateInboxParams
|
|
125
120
|
},
|
|
126
121
|
{
|
|
127
122
|
name: "list_threads",
|
|
128
|
-
method: "threads.list",
|
|
129
|
-
description: "List
|
|
123
|
+
method: "inboxes.threads.list",
|
|
124
|
+
description: "List threads in inbox",
|
|
130
125
|
schema: ListThreadsParams
|
|
131
126
|
},
|
|
132
127
|
{
|
|
133
128
|
name: "get_thread",
|
|
134
|
-
method: "threads.get",
|
|
135
|
-
description: "Get
|
|
129
|
+
method: "inboxes.threads.get",
|
|
130
|
+
description: "Get thread",
|
|
136
131
|
schema: GetThreadParams
|
|
137
132
|
},
|
|
138
133
|
{
|
|
139
134
|
name: "list_messages",
|
|
140
|
-
method: "messages.list",
|
|
141
|
-
description: "List
|
|
135
|
+
method: "inboxes.messages.list",
|
|
136
|
+
description: "List messages in inbox",
|
|
142
137
|
schema: ListMessagesParams
|
|
143
138
|
},
|
|
144
139
|
{
|
|
145
140
|
name: "get_message",
|
|
146
|
-
method: "messages.get",
|
|
147
|
-
description: "Get
|
|
141
|
+
method: "inboxes.messages.get",
|
|
142
|
+
description: "Get message",
|
|
148
143
|
schema: GetMessageParams
|
|
149
144
|
},
|
|
150
|
-
{
|
|
151
|
-
name: "get_attachment",
|
|
152
|
-
method: "attachments.get",
|
|
153
|
-
description: "Get an attachment by ID",
|
|
154
|
-
schema: GetAttachmentParams
|
|
155
|
-
},
|
|
156
145
|
{
|
|
157
146
|
name: "send_message",
|
|
158
|
-
method: "messages.send",
|
|
159
|
-
description: "Send
|
|
147
|
+
method: "inboxes.messages.send",
|
|
148
|
+
description: "Send message",
|
|
160
149
|
schema: SendMessageParams
|
|
161
150
|
},
|
|
162
151
|
{
|
|
163
152
|
name: "reply_to_message",
|
|
164
|
-
method: "messages.reply",
|
|
165
|
-
description: "Reply to
|
|
153
|
+
method: "inboxes.messages.reply",
|
|
154
|
+
description: "Reply to message",
|
|
166
155
|
schema: ReplyToMessageParams
|
|
167
156
|
}
|
|
168
157
|
];
|