agentmail-toolkit 0.1.13 → 0.1.15
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 +4 -4
- package/dist/ai-sdk.js.map +1 -1
- package/dist/ai-sdk.mjs +2 -1
- package/dist/ai-sdk.mjs.map +1 -1
- package/dist/chunk-2QQE6LPN.mjs +38 -0
- package/dist/chunk-2QQE6LPN.mjs.map +1 -0
- package/dist/{chunk-7HJYREI4.mjs → chunk-ZRECFCU2.mjs} +7 -35
- package/dist/chunk-ZRECFCU2.mjs.map +1 -0
- package/dist/langchain.js +5 -5
- package/dist/langchain.js.map +1 -1
- package/dist/langchain.mjs +3 -2
- package/dist/langchain.mjs.map +1 -1
- package/dist/mcp.d.mts +9 -0
- package/dist/mcp.d.ts +9 -0
- package/dist/mcp.js +176 -0
- package/dist/mcp.js.map +1 -0
- package/dist/mcp.mjs +22 -0
- package/dist/mcp.mjs.map +1 -0
- package/package.json +12 -7
- package/dist/chunk-7HJYREI4.mjs.map +0 -1
- package/dist/chunk-UF44LGSE.mjs +0 -149
- package/dist/chunk-UF44LGSE.mjs.map +0 -1
- package/dist/chunk-ZPF3SOVL.mjs +0 -167
- package/dist/chunk-ZPF3SOVL.mjs.map +0 -1
- package/dist/toolkit-BonhsWAN.d.mts +0 -19
- package/dist/toolkit-BonhsWAN.d.ts +0 -19
package/dist/ai-sdk.js
CHANGED
|
@@ -45,15 +45,15 @@ var Wrapper = class {
|
|
|
45
45
|
var import_zod = require("zod");
|
|
46
46
|
var ListItemsParams = import_zod.z.object({
|
|
47
47
|
limit: import_zod.z.number().optional().describe("The maximum number of items to return"),
|
|
48
|
-
last_key: import_zod.z.string().optional().describe("The last key to use for pagination
|
|
48
|
+
last_key: import_zod.z.string().optional().describe("The last key to use for pagination")
|
|
49
49
|
});
|
|
50
50
|
var GetInboxParams = import_zod.z.object({
|
|
51
51
|
inbox_id: import_zod.z.string().describe("The ID of the inbox to get")
|
|
52
52
|
});
|
|
53
53
|
var CreateInboxParams = import_zod.z.object({
|
|
54
|
-
username: import_zod.z.string().optional().describe("The username of the inbox to create
|
|
55
|
-
domain: import_zod.z.string().optional().describe("The domain of the inbox to create
|
|
56
|
-
display_name: import_zod.z.string().optional().describe("The display name of the inbox to create
|
|
54
|
+
username: import_zod.z.string().optional().describe("The username of the inbox to create"),
|
|
55
|
+
domain: import_zod.z.string().optional().describe("The domain of the inbox to create"),
|
|
56
|
+
display_name: import_zod.z.string().optional().describe("The display name of the inbox to create")
|
|
57
57
|
});
|
|
58
58
|
var ListThreadsParams = ListItemsParams.extend({
|
|
59
59
|
inbox_id: import_zod.z.string().describe("The ID of the inbox to list threads for"),
|
package/dist/ai-sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ai-sdk.ts","../src/wrapper.ts","../src/schemas.ts","../src/tools.ts","../src/toolkit.ts"],"sourcesContent":["import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { MapToolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends MapToolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.schema,\n execute: (args) => this.callMethod(tool.method, args),\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 callMethod(method: string, args: unknown) {\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 return await parent[methodKey].call(parent, args)\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. Only use the last_key value returned by the previous response.'),\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)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EACZ;AACJ;;;AC9DO,IAAe,aAAf,cAAqC,QAAQ;AAAA,EAC7B,QAA2B,CAAC;AAAA,EAE/C,YAAY,QAA0B;AAClC,UAAM,MAAM;AAEZ,SAAK,QAAQ,MAAM;AAAA,MACf,CAAC,KAAK,SAAS;AACX,YAAI,KAAK,IAAI,IAAI,KAAK,UAAU,IAAI;AACpC,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAIO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;;;AJnCO,IAAM,mBAAN,cAA+B,WAAsB;AAAA,EACxD,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAAuB;AACvC,WAAO;AAAA,MACH,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,CAAC,SAAS,KAAK,WAAW,KAAK,QAAQ,IAAI;AAAA,IACxD;AAAA,EACJ;AACJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/ai-sdk.ts","../src/wrapper.ts","../src/schemas.ts","../src/tools.ts","../src/toolkit.ts"],"sourcesContent":["import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { MapToolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends MapToolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.schema,\n execute: (args) => this.callMethod(tool.method, args),\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 callMethod(method: string, args: unknown) {\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 return await parent[methodKey].call(parent, args)\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;;;ACAA,uBAAgC;AAEzB,IAAM,UAAN,MAAc;AAAA,EACjB,YAA6B,QAA0B;AAA1B;AACzB,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,iCAAgB;AAAA,EACxD;AAAA,EAEA,MAAa,WAAW,QAAgB,MAAe;AACnD,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,WAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;;;AClBA,iBAAkB;AAEX,IAAM,kBAAkB,aAAE,OAAO;AAAA,EACpC,OAAO,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AACjF,CAAC;AAEM,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACnC,UAAU,aAAE,OAAO,EAAE,SAAS,4BAA4B;AAC9D,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACtC,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,qCAAqC;AAAA,EAC9E,QAAQ,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,mCAAmC;AAAA,EAC1E,cAAc,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,yCAAyC;AAC1F,CAAC;AAEM,IAAM,o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;AAAA,EACZ;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,EACZ;AACJ;;;AC9DO,IAAe,aAAf,cAAqC,QAAQ;AAAA,EAC7B,QAA2B,CAAC;AAAA,EAE/C,YAAY,QAA0B;AAClC,UAAM,MAAM;AAEZ,SAAK,QAAQ,MAAM;AAAA,MACf,CAAC,KAAK,SAAS;AACX,YAAI,KAAK,IAAI,IAAI,KAAK,UAAU,IAAI;AACpC,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAIO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;;;AJnCO,IAAM,mBAAN,cAA+B,WAAsB;AAAA,EACxD,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAAuB;AACvC,WAAO;AAAA,MACH,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,CAAC,SAAS,KAAK,WAAW,KAAK,QAAQ,IAAI;AAAA,IACxD;AAAA,EACJ;AACJ;","names":[]}
|
package/dist/ai-sdk.mjs
CHANGED
package/dist/ai-sdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ai-sdk.ts"],"sourcesContent":["import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { MapToolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends MapToolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.schema,\n execute: (args) => this.callMethod(tool.method, args),\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/ai-sdk.ts"],"sourcesContent":["import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { MapToolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends MapToolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.schema,\n execute: (args) => this.callMethod(tool.method, args),\n }\n }\n}\n"],"mappings":";;;;;;AAMO,IAAM,mBAAN,cAA+B,WAAsB;AAAA,EACxD,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAAuB;AACvC,WAAO;AAAA,MACH,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,CAAC,SAAS,KAAK,WAAW,KAAK,QAAQ,IAAI;AAAA,IACxD;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Wrapper,
|
|
3
|
+
tools
|
|
4
|
+
} from "./chunk-ZRECFCU2.mjs";
|
|
5
|
+
|
|
6
|
+
// src/toolkit.ts
|
|
7
|
+
var ListToolkit = class extends Wrapper {
|
|
8
|
+
tools = [];
|
|
9
|
+
constructor(client) {
|
|
10
|
+
super(client);
|
|
11
|
+
this.tools = tools.map((tool) => this.buildTool(tool));
|
|
12
|
+
}
|
|
13
|
+
getTools() {
|
|
14
|
+
return this.tools;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var MapToolkit = class extends Wrapper {
|
|
18
|
+
tools = {};
|
|
19
|
+
constructor(client) {
|
|
20
|
+
super(client);
|
|
21
|
+
this.tools = tools.reduce(
|
|
22
|
+
(acc, tool) => {
|
|
23
|
+
acc[tool.name] = this.buildTool(tool);
|
|
24
|
+
return acc;
|
|
25
|
+
},
|
|
26
|
+
{}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
getTools() {
|
|
30
|
+
return this.tools;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
ListToolkit,
|
|
36
|
+
MapToolkit
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=chunk-2QQE6LPN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/toolkit.ts"],"sourcesContent":["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":";;;;;;AAKO,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;AAEO,IAAe,aAAf,cAAqC,QAAQ;AAAA,EAC7B,QAA2B,CAAC;AAAA,EAE/C,YAAY,QAA0B;AAClC,UAAM,MAAM;AAEZ,SAAK,QAAQ,MAAM;AAAA,MACf,CAAC,KAAK,SAAS;AACX,YAAI,KAAK,IAAI,IAAI,KAAK,UAAU,IAAI;AACpC,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAIO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
|
|
@@ -19,15 +19,15 @@ var Wrapper = class {
|
|
|
19
19
|
import { z } from "zod";
|
|
20
20
|
var ListItemsParams = z.object({
|
|
21
21
|
limit: z.number().optional().describe("The maximum number of items to return"),
|
|
22
|
-
last_key: z.string().optional().describe("The last key to use for pagination
|
|
22
|
+
last_key: z.string().optional().describe("The last key to use for pagination")
|
|
23
23
|
});
|
|
24
24
|
var GetInboxParams = z.object({
|
|
25
25
|
inbox_id: z.string().describe("The ID of the inbox to get")
|
|
26
26
|
});
|
|
27
27
|
var CreateInboxParams = z.object({
|
|
28
|
-
username: z.string().optional().describe("The username of the inbox to create
|
|
29
|
-
domain: z.string().optional().describe("The domain of the inbox to create
|
|
30
|
-
display_name: z.string().optional().describe("The display name of the inbox to create
|
|
28
|
+
username: z.string().optional().describe("The username of the inbox to create"),
|
|
29
|
+
domain: z.string().optional().describe("The domain of the inbox to create"),
|
|
30
|
+
display_name: z.string().optional().describe("The display name of the inbox to create")
|
|
31
31
|
});
|
|
32
32
|
var ListThreadsParams = ListItemsParams.extend({
|
|
33
33
|
inbox_id: z.string().describe("The ID of the inbox to list threads for"),
|
|
@@ -130,36 +130,8 @@ var tools = [
|
|
|
130
130
|
}
|
|
131
131
|
];
|
|
132
132
|
|
|
133
|
-
// src/toolkit.ts
|
|
134
|
-
var ListToolkit = class extends Wrapper {
|
|
135
|
-
tools = [];
|
|
136
|
-
constructor(client) {
|
|
137
|
-
super(client);
|
|
138
|
-
this.tools = tools.map((tool) => this.buildTool(tool));
|
|
139
|
-
}
|
|
140
|
-
getTools() {
|
|
141
|
-
return this.tools;
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
var MapToolkit = class extends Wrapper {
|
|
145
|
-
tools = {};
|
|
146
|
-
constructor(client) {
|
|
147
|
-
super(client);
|
|
148
|
-
this.tools = tools.reduce(
|
|
149
|
-
(acc, tool) => {
|
|
150
|
-
acc[tool.name] = this.buildTool(tool);
|
|
151
|
-
return acc;
|
|
152
|
-
},
|
|
153
|
-
{}
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
getTools() {
|
|
157
|
-
return this.tools;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
133
|
export {
|
|
162
|
-
|
|
163
|
-
|
|
134
|
+
Wrapper,
|
|
135
|
+
tools
|
|
164
136
|
};
|
|
165
|
-
//# sourceMappingURL=chunk-
|
|
137
|
+
//# sourceMappingURL=chunk-ZRECFCU2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/wrapper.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["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 callMethod(method: string, args: unknown) {\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 return await parent[methodKey].call(parent, args)\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"],"mappings":";AAAA,SAAS,uBAAuB;AAEzB,IAAM,UAAN,MAAc;AAAA,EACjB,YAA6B,QAA0B;AAA1B;AACzB,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,gBAAgB;AAAA,EACxD;AAAA,EAEA,MAAa,WAAW,QAAgB,MAAe;AACnD,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,WAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;;;AClBA,SAAS,SAAS;AAEX,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AACjF,CAAC;AAEM,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACnC,UAAU,EAAE,OAAO,EAAE,SAAS,4BAA4B;AAC9D,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACtC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,qCAAqC;AAAA,EAC9E,QAAQ,EAAE,OAAO,EAAE,SAAS,E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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/langchain.js
CHANGED
|
@@ -46,15 +46,15 @@ var Wrapper = class {
|
|
|
46
46
|
var import_zod = require("zod");
|
|
47
47
|
var ListItemsParams = import_zod.z.object({
|
|
48
48
|
limit: import_zod.z.number().optional().describe("The maximum number of items to return"),
|
|
49
|
-
last_key: import_zod.z.string().optional().describe("The last key to use for pagination
|
|
49
|
+
last_key: import_zod.z.string().optional().describe("The last key to use for pagination")
|
|
50
50
|
});
|
|
51
51
|
var GetInboxParams = import_zod.z.object({
|
|
52
52
|
inbox_id: import_zod.z.string().describe("The ID of the inbox to get")
|
|
53
53
|
});
|
|
54
54
|
var CreateInboxParams = import_zod.z.object({
|
|
55
|
-
username: import_zod.z.string().optional().describe("The username of the inbox to create
|
|
56
|
-
domain: import_zod.z.string().optional().describe("The domain of the inbox to create
|
|
57
|
-
display_name: import_zod.z.string().optional().describe("The display name of the inbox to create
|
|
55
|
+
username: import_zod.z.string().optional().describe("The username of the inbox to create"),
|
|
56
|
+
domain: import_zod.z.string().optional().describe("The domain of the inbox to create"),
|
|
57
|
+
display_name: import_zod.z.string().optional().describe("The display name of the inbox to create")
|
|
58
58
|
});
|
|
59
59
|
var ListThreadsParams = ListItemsParams.extend({
|
|
60
60
|
inbox_id: import_zod.z.string().describe("The ID of the inbox to list threads for"),
|
|
@@ -178,7 +178,7 @@ var AgentMailToolkit = class extends ListToolkit {
|
|
|
178
178
|
return (0, import_tools2.tool)(
|
|
179
179
|
async (args) => {
|
|
180
180
|
const result = await this.callMethod(tool.method, args);
|
|
181
|
-
return
|
|
181
|
+
return JSON.stringify(result, null, 2);
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
name: tool.name,
|
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(\n async (args) => {\n const result = await this.callMethod(tool.method, args)\n return result.toString()\n },\n {\n name: tool.name,\n description: tool.description,\n schema: tool.schema,\n }\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 callMethod(method: string, args: unknown) {\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 return await parent[methodKey].call(parent, args)\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. Only use the last_key value returned by the previous response.'),\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,WAAW,QAAgB,MAAe;AACn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,EAChB;AAAA,EAEU,UAAU,MAA4B;AAC5C,eAAO,cAAAC;AAAA,MACH,OAAO,SAAS;AACZ,cAAM,SAAS,MAAM,KAAK,WAAW,KAAK,QAAQ,IAAI;AACtD,eAAO,OAAO,SAAS;AAAA,MAC3B;AAAA,MACA;AAAA,QACI,MAAM,KAAK;AAAA,QACX,aAAa,KAAK;AAAA,QAClB,QAAQ,KAAK;AAAA,MACjB;AAAA,IACJ;AAAA,EACJ;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(\n async (args) => {\n const result = await this.callMethod(tool.method, args)\n return JSON.stringify(result, null, 2)\n },\n {\n name: tool.name,\n description: tool.description,\n schema: tool.schema,\n }\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 callMethod(method: string, args: unknown) {\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 return await parent[methodKey].call(parent, args)\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;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;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;AAAA,MACH,OAAO,SAAS;AACZ,cAAM,SAAS,MAAM,KAAK,WAAW,KAAK,QAAQ,IAAI;AACtD,eAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AAAA,MACzC;AAAA,MACA;AAAA,QACI,MAAM,KAAK;AAAA,QACX,aAAa,KAAK;AAAA,QAClB,QAAQ,KAAK;AAAA,MACjB;AAAA,IACJ;AAAA,EACJ;AACJ;","names":["import_tools","langchainTool"]}
|
package/dist/langchain.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ListToolkit
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2QQE6LPN.mjs";
|
|
4
|
+
import "./chunk-ZRECFCU2.mjs";
|
|
4
5
|
|
|
5
6
|
// src/langchain.ts
|
|
6
7
|
import { tool as langchainTool } from "@langchain/core/tools";
|
|
@@ -12,7 +13,7 @@ var AgentMailToolkit = class extends ListToolkit {
|
|
|
12
13
|
return langchainTool(
|
|
13
14
|
async (args) => {
|
|
14
15
|
const result = await this.callMethod(tool.method, args);
|
|
15
|
-
return
|
|
16
|
+
return JSON.stringify(result, null, 2);
|
|
16
17
|
},
|
|
17
18
|
{
|
|
18
19
|
name: tool.name,
|
package/dist/langchain.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/langchain.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(\n async (args) => {\n const result = await this.callMethod(tool.method, args)\n return
|
|
1
|
+
{"version":3,"sources":["../src/langchain.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(\n async (args) => {\n const result = await this.callMethod(tool.method, args)\n return JSON.stringify(result, null, 2)\n },\n {\n name: tool.name,\n description: tool.description,\n schema: tool.schema,\n }\n )\n }\n}\n"],"mappings":";;;;;;AAAA,SAA8B,QAAQ,qBAAqB;AAMpD,IAAM,mBAAN,cAA+B,YAA4B;AAAA,EAC9D,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAA4B;AAC5C,WAAO;AAAA,MACH,OAAO,SAAS;AACZ,cAAM,SAAS,MAAM,KAAK,WAAW,KAAK,QAAQ,IAAI;AACtD,eAAO,KAAK,UAAU,QAAQ,MAAM,CAAC;AAAA,MACzC;AAAA,MACA;AAAA,QACI,MAAM,KAAK;AAAA,QACX,aAAa,KAAK;AAAA,QAClB,QAAQ,KAAK;AAAA,MACjB;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
|
package/dist/mcp.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { AgentMailClient } from 'agentmail';
|
|
3
|
+
|
|
4
|
+
declare class AgentMailMcpServer extends McpServer {
|
|
5
|
+
private wrapper;
|
|
6
|
+
constructor(client?: AgentMailClient);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { AgentMailMcpServer };
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { AgentMailClient } from 'agentmail';
|
|
3
|
+
|
|
4
|
+
declare class AgentMailMcpServer extends McpServer {
|
|
5
|
+
private wrapper;
|
|
6
|
+
constructor(client?: AgentMailClient);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { AgentMailMcpServer };
|
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/mcp.ts
|
|
21
|
+
var mcp_exports = {};
|
|
22
|
+
__export(mcp_exports, {
|
|
23
|
+
AgentMailMcpServer: () => AgentMailMcpServer
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(mcp_exports);
|
|
26
|
+
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
27
|
+
|
|
28
|
+
// src/wrapper.ts
|
|
29
|
+
var import_agentmail = require("agentmail");
|
|
30
|
+
var Wrapper = class {
|
|
31
|
+
constructor(client) {
|
|
32
|
+
this.client = client;
|
|
33
|
+
if (!this.client) this.client = new import_agentmail.AgentMailClient();
|
|
34
|
+
}
|
|
35
|
+
async callMethod(method, args) {
|
|
36
|
+
const parts = method.split(".");
|
|
37
|
+
const methodKey = parts.pop();
|
|
38
|
+
if (!methodKey) throw new Error("Method name empty");
|
|
39
|
+
let parent = this.client;
|
|
40
|
+
for (const part of parts) parent = parent[part];
|
|
41
|
+
return await parent[methodKey].call(parent, args);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// src/schemas.ts
|
|
46
|
+
var import_zod = require("zod");
|
|
47
|
+
var ListItemsParams = import_zod.z.object({
|
|
48
|
+
limit: import_zod.z.number().optional().describe("The maximum number of items to return"),
|
|
49
|
+
last_key: import_zod.z.string().optional().describe("The last key to use for pagination")
|
|
50
|
+
});
|
|
51
|
+
var GetInboxParams = import_zod.z.object({
|
|
52
|
+
inbox_id: import_zod.z.string().describe("The ID of the inbox to get")
|
|
53
|
+
});
|
|
54
|
+
var CreateInboxParams = import_zod.z.object({
|
|
55
|
+
username: import_zod.z.string().optional().describe("The username of the inbox to create"),
|
|
56
|
+
domain: import_zod.z.string().optional().describe("The domain of the inbox to create"),
|
|
57
|
+
display_name: import_zod.z.string().optional().describe("The display name of the inbox to create")
|
|
58
|
+
});
|
|
59
|
+
var ListThreadsParams = ListItemsParams.extend({
|
|
60
|
+
inbox_id: import_zod.z.string().describe("The ID of the inbox to list threads for"),
|
|
61
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("The labels to filter threads by")
|
|
62
|
+
});
|
|
63
|
+
var GetThreadParams = import_zod.z.object({
|
|
64
|
+
inbox_id: import_zod.z.string().describe("The ID of the inbox to get the thread for"),
|
|
65
|
+
thread_id: import_zod.z.string().describe("The ID of the thread to get")
|
|
66
|
+
});
|
|
67
|
+
var ListMessagesParams = ListItemsParams.extend({
|
|
68
|
+
inbox_id: import_zod.z.string().describe("The ID of the inbox to list messages for"),
|
|
69
|
+
labels: import_zod.z.array(import_zod.z.string()).optional().describe("The labels to filter messages by")
|
|
70
|
+
});
|
|
71
|
+
var GetMessageParams = import_zod.z.object({
|
|
72
|
+
inbox_id: import_zod.z.string().describe("The ID of the inbox to get the message for"),
|
|
73
|
+
message_id: import_zod.z.string().describe("The ID of the message to get")
|
|
74
|
+
});
|
|
75
|
+
var GetAttachmentParams = import_zod.z.object({
|
|
76
|
+
inbox_id: import_zod.z.string().describe("The ID of the inbox to get the attachment for"),
|
|
77
|
+
message_id: import_zod.z.string().describe("The ID of the message to get the attachment for"),
|
|
78
|
+
attachment_id: import_zod.z.string().describe("The ID of the attachment to get")
|
|
79
|
+
});
|
|
80
|
+
var SendMessageParams = import_zod.z.object({
|
|
81
|
+
inbox_id: import_zod.z.string().describe("The ID of the inbox to send the message from"),
|
|
82
|
+
to: import_zod.z.array(import_zod.z.string()).describe("The list of recipients"),
|
|
83
|
+
cc: import_zod.z.array(import_zod.z.string()).optional().describe("The list of CC recipients"),
|
|
84
|
+
bcc: import_zod.z.array(import_zod.z.string()).optional().describe("The list of BCC recipients"),
|
|
85
|
+
subject: import_zod.z.string().optional().describe("The subject of the message"),
|
|
86
|
+
text: import_zod.z.string().optional().describe("The plain text body of the message"),
|
|
87
|
+
html: import_zod.z.string().optional().describe("The HTML body of the message")
|
|
88
|
+
});
|
|
89
|
+
var ReplyToMessageParams = import_zod.z.object({
|
|
90
|
+
inbox_id: import_zod.z.string().describe("The inbox ID of the inbox to reply to the message from"),
|
|
91
|
+
message_id: import_zod.z.string().describe("The message ID of the message you wish to reply to"),
|
|
92
|
+
text: import_zod.z.string().optional().describe("The plain text body of the reply"),
|
|
93
|
+
html: import_zod.z.string().optional().describe("The HTML body of the reply")
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// src/tools.ts
|
|
97
|
+
var tools = [
|
|
98
|
+
{
|
|
99
|
+
name: "list_inboxes",
|
|
100
|
+
method: "inboxes.list",
|
|
101
|
+
description: "List all inboxes",
|
|
102
|
+
schema: ListItemsParams
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "get_inbox",
|
|
106
|
+
method: "inboxes.get",
|
|
107
|
+
description: "Get an inbox by ID",
|
|
108
|
+
schema: GetInboxParams
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "create_inbox",
|
|
112
|
+
method: "inboxes.create",
|
|
113
|
+
description: "Create a new inbox",
|
|
114
|
+
schema: CreateInboxParams
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "list_threads",
|
|
118
|
+
method: "threads.list",
|
|
119
|
+
description: "List all threads",
|
|
120
|
+
schema: ListThreadsParams
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "get_thread",
|
|
124
|
+
method: "threads.get",
|
|
125
|
+
description: "Get a thread by ID",
|
|
126
|
+
schema: GetThreadParams
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "list_messages",
|
|
130
|
+
method: "messages.list",
|
|
131
|
+
description: "List all messages",
|
|
132
|
+
schema: ListMessagesParams
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "get_message",
|
|
136
|
+
method: "messages.get",
|
|
137
|
+
description: "Get a message by ID",
|
|
138
|
+
schema: GetMessageParams
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "get_attachment",
|
|
142
|
+
method: "attachments.get",
|
|
143
|
+
description: "Get an attachment by ID",
|
|
144
|
+
schema: GetAttachmentParams
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "send_message",
|
|
148
|
+
method: "messages.send",
|
|
149
|
+
description: "Send a message",
|
|
150
|
+
schema: SendMessageParams
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "reply_to_message",
|
|
154
|
+
method: "messages.reply",
|
|
155
|
+
description: "Reply to a message",
|
|
156
|
+
schema: ReplyToMessageParams
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
// src/mcp.ts
|
|
161
|
+
var AgentMailMcpServer = class extends import_mcp.McpServer {
|
|
162
|
+
wrapper;
|
|
163
|
+
constructor(client) {
|
|
164
|
+
super({
|
|
165
|
+
name: "AgentMail",
|
|
166
|
+
version: "0.1.0"
|
|
167
|
+
});
|
|
168
|
+
this.wrapper = new Wrapper(client);
|
|
169
|
+
for (const tool of tools) this.tool(tool.name, tool.description, tool.schema.shape, (args) => this.wrapper.callMethod(tool.method, args));
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
+
0 && (module.exports = {
|
|
174
|
+
AgentMailMcpServer
|
|
175
|
+
});
|
|
176
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp.ts","../src/wrapper.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Wrapper } from './wrapper'\nimport { tools } from './tools'\n\nexport class AgentMailMcpServer extends McpServer {\n private wrapper: Wrapper\n\n constructor(client?: AgentMailClient) {\n super({\n name: 'AgentMail',\n version: '0.1.0',\n })\n\n this.wrapper = new Wrapper(client)\n\n for (const tool of tools) this.tool(tool.name, tool.description, tool.schema.shape, (args: unknown) => this.wrapper.callMethod(tool.method, args))\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 callMethod(method: string, args: unknown) {\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 return await parent[methodKey].call(parent, args)\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA0B;;;ACA1B,uBAAgC;AAEzB,IAAM,UAAN,MAAc;AAAA,EACjB,YAA6B,QAA0B;AAA1B;AACzB,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,iCAAgB;AAAA,EACxD;AAAA,EAEA,MAAa,WAAW,Q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AAAA,EACrJ;AACJ;","names":[]}
|
package/dist/mcp.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Wrapper,
|
|
3
|
+
tools
|
|
4
|
+
} from "./chunk-ZRECFCU2.mjs";
|
|
5
|
+
|
|
6
|
+
// src/mcp.ts
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
var AgentMailMcpServer = class extends McpServer {
|
|
9
|
+
wrapper;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
super({
|
|
12
|
+
name: "AgentMail",
|
|
13
|
+
version: "0.1.0"
|
|
14
|
+
});
|
|
15
|
+
this.wrapper = new Wrapper(client);
|
|
16
|
+
for (const tool of tools) this.tool(tool.name, tool.description, tool.schema.shape, (args) => this.wrapper.callMethod(tool.method, args));
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
AgentMailMcpServer
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=mcp.mjs.map
|
package/dist/mcp.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Wrapper } from './wrapper'\nimport { tools } from './tools'\n\nexport class AgentMailMcpServer extends McpServer {\n private wrapper: Wrapper\n\n constructor(client?: AgentMailClient) {\n super({\n name: 'AgentMail',\n version: '0.1.0',\n })\n\n this.wrapper = new Wrapper(client)\n\n for (const tool of tools) this.tool(tool.name, tool.description, tool.schema.shape, (args: unknown) => this.wrapper.callMethod(tool.method, args))\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,iBAAiB;AAMnB,IAAM,qBAAN,cAAiC,UAAU;AAAA,EACtC;AAAA,EAER,YAAY,QAA0B;AAClC,UAAM;AAAA,MACF,MAAM;AAAA,MACN,SAAS;AAAA,IACb,CAAC;AAED,SAAK,UAAU,IAAI,QAAQ,MAAM;AAEjC,eAAW,QAAQ,MAAO,MAAK,KAAK,KAAK,MAAM,KAAK,aAAa,KAAK,OAAO,OAAO,CAAC,SAAkB,KAAK,QAAQ,WAAW,KAAK,QAAQ,IAAI,CAAC;AAAA,EACrJ;AACJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentmail-toolkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "AgentMail Toolkit",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
7
7
|
"lint": "eslint .",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"prettier": "prettier --write .",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"AgentMail",
|
|
13
|
+
"Toolkit"
|
|
14
|
+
],
|
|
11
15
|
"author": "AgentMail <support@agentmail.to>",
|
|
12
16
|
"license": "MIT",
|
|
13
17
|
"repository": {
|
|
14
18
|
"type": "git",
|
|
15
19
|
"url": "git+https://github.com/agentmail-to/agentmail-toolkit.git"
|
|
16
20
|
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
"AgentMail",
|
|
19
|
-
"Toolkit"
|
|
20
|
-
],
|
|
21
21
|
"packageManager": "pnpm@10.6.4",
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
"types": "./dist/langchain.d.ts",
|
|
33
33
|
"import": "./dist/langchain.mjs",
|
|
34
34
|
"require": "./dist/langchain.js"
|
|
35
|
+
},
|
|
36
|
+
"./mcp": {
|
|
37
|
+
"types": "./dist/mcp.d.ts",
|
|
38
|
+
"import": "./dist/mcp.mjs",
|
|
39
|
+
"require": "./dist/mcp.js"
|
|
35
40
|
}
|
|
36
41
|
},
|
|
37
42
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wrapper.ts","../src/schemas.ts","../src/tools.ts","../src/toolkit.ts"],"sourcesContent":["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 callMethod(method: string, args: unknown) {\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 return await parent[methodKey].call(parent, args)\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. Only use the last_key value returned by the previous response.'),\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,SAAS,uBAAuB;AAEzB,IAAM,UAAN,MAAc;AAAA,EACjB,YAA6B,QAA0B;AAA1B;AACzB,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,gBAAgB;AAAA,EACxD;AAAA,EAEA,MAAa,WAAW,QAAgB,MAAe;AACnD,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,WAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;;;AClBA,SAAS,SAAS;AAEX,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oGAAoG;AACjJ,CAA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A;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;;;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;AAEO,IAAe,aAAf,cAAqC,QAAQ;AAAA,EAC7B,QAA2B,CAAC;AAAA,EAE/C,YAAY,QAA0B;AAClC,UAAM,MAAM;AAEZ,SAAK,QAAQ,MAAM;AAAA,MACf,CAAC,KAAK,SAAS;AACX,YAAI,KAAK,IAAI,IAAI,KAAK,UAAU,IAAI;AACpC,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAIO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
|
package/dist/chunk-UF44LGSE.mjs
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
// src/toolkit.ts
|
|
2
|
-
import { AgentMailClient } from "agentmail";
|
|
3
|
-
|
|
4
|
-
// src/schemas.ts
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
var ListItemsParams = z.object({
|
|
7
|
-
limit: z.number().optional().describe("The maximum number of items to return"),
|
|
8
|
-
last_key: z.string().optional().describe("The last key to use for pagination")
|
|
9
|
-
});
|
|
10
|
-
var GetInboxParams = z.object({
|
|
11
|
-
inbox_id: z.string().describe("The ID of the inbox to get")
|
|
12
|
-
});
|
|
13
|
-
var CreateInboxParams = z.object({
|
|
14
|
-
username: z.string().optional().describe("The username of the inbox to create."),
|
|
15
|
-
domain: z.string().optional().describe("The domain of the inbox to create."),
|
|
16
|
-
display_name: z.string().optional().describe("The display name of the inbox to create.")
|
|
17
|
-
});
|
|
18
|
-
var ListThreadsParams = ListItemsParams.extend({
|
|
19
|
-
inbox_id: z.string().describe("The ID of the inbox to list threads for"),
|
|
20
|
-
received: z.boolean().optional().describe("Whether to filter by received threads"),
|
|
21
|
-
sent: z.boolean().optional().describe("Whether to filter by sent threads")
|
|
22
|
-
});
|
|
23
|
-
var GetThreadParams = z.object({
|
|
24
|
-
inbox_id: z.string().describe("The ID of the inbox to get the thread for"),
|
|
25
|
-
thread_id: z.string().describe("The ID of the thread to get")
|
|
26
|
-
});
|
|
27
|
-
var ListMessagesParams = ListItemsParams.extend({
|
|
28
|
-
inbox_id: z.string().describe("The ID of the inbox to list messages for")
|
|
29
|
-
});
|
|
30
|
-
var GetMessageParams = z.object({
|
|
31
|
-
inbox_id: z.string().describe("The ID of the inbox to get the message for"),
|
|
32
|
-
message_id: z.string().describe("The ID of the message to get")
|
|
33
|
-
});
|
|
34
|
-
var GetAttachmentParams = z.object({
|
|
35
|
-
inbox_id: z.string().describe("The ID of the inbox to get the attachment for"),
|
|
36
|
-
message_id: z.string().describe("The ID of the message to get the attachment for"),
|
|
37
|
-
attachment_id: z.string().describe("The ID of the attachment to get")
|
|
38
|
-
});
|
|
39
|
-
var SendMessageParams = z.object({
|
|
40
|
-
inbox_id: z.string().describe("The ID of the inbox to send the message from"),
|
|
41
|
-
to: z.array(z.string()).describe("The list of recipients"),
|
|
42
|
-
cc: z.array(z.string()).optional().describe("The list of CC recipients"),
|
|
43
|
-
bcc: z.array(z.string()).optional().describe("The list of BCC recipients"),
|
|
44
|
-
subject: z.string().optional().describe("The subject of the message"),
|
|
45
|
-
text: z.string().optional().describe("The plain text body of the message"),
|
|
46
|
-
html: z.string().optional().describe("The HTML body of the message")
|
|
47
|
-
});
|
|
48
|
-
var ReplyToMessageParams = z.object({
|
|
49
|
-
inbox_id: z.string().describe("The inboc ID of the inbox to reply to the message from"),
|
|
50
|
-
message_id: z.string().describe("The message ID of the message you wish to reply to"),
|
|
51
|
-
text: z.string().optional().describe("The plain text body of the reply"),
|
|
52
|
-
html: z.string().optional().describe("The HTML body of the reply")
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// src/tools.ts
|
|
56
|
-
var tools = [
|
|
57
|
-
{
|
|
58
|
-
name: "list_inboxes",
|
|
59
|
-
methodName: "inboxes.list",
|
|
60
|
-
description: "List all inboxes",
|
|
61
|
-
paramsSchema: ListItemsParams
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "get_inbox",
|
|
65
|
-
methodName: "inboxes.get",
|
|
66
|
-
description: "Get an inbox by ID",
|
|
67
|
-
paramsSchema: GetInboxParams
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "create_inbox",
|
|
71
|
-
methodName: "inboxes.create",
|
|
72
|
-
description: "Create a new inbox",
|
|
73
|
-
paramsSchema: CreateInboxParams
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "list_threads",
|
|
77
|
-
methodName: "threads.list",
|
|
78
|
-
description: "List all threads",
|
|
79
|
-
paramsSchema: ListThreadsParams
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "get_thread",
|
|
83
|
-
methodName: "threads.get",
|
|
84
|
-
description: "Get a thread by ID",
|
|
85
|
-
paramsSchema: GetThreadParams
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: "list_messages",
|
|
89
|
-
methodName: "messages.list",
|
|
90
|
-
description: "List all messages",
|
|
91
|
-
paramsSchema: ListMessagesParams
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
name: "get_message",
|
|
95
|
-
methodName: "messages.get",
|
|
96
|
-
description: "Get a message by ID",
|
|
97
|
-
paramsSchema: GetMessageParams
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "get_attachment",
|
|
101
|
-
methodName: "attachments.get",
|
|
102
|
-
description: "Get an attachment by ID",
|
|
103
|
-
paramsSchema: GetAttachmentParams
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: "send_message",
|
|
107
|
-
methodName: "messages.send",
|
|
108
|
-
description: "Send a message",
|
|
109
|
-
paramsSchema: SendMessageParams
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: "reply_to_message",
|
|
113
|
-
methodName: "messages.reply",
|
|
114
|
-
description: "Reply to a message",
|
|
115
|
-
paramsSchema: ReplyToMessageParams
|
|
116
|
-
}
|
|
117
|
-
];
|
|
118
|
-
|
|
119
|
-
// src/toolkit.ts
|
|
120
|
-
var Toolkit = class {
|
|
121
|
-
constructor(client) {
|
|
122
|
-
this.client = client;
|
|
123
|
-
if (!this.client) this.client = new AgentMailClient();
|
|
124
|
-
this.tools = tools.reduce(
|
|
125
|
-
(acc, tool) => {
|
|
126
|
-
acc[tool.name] = this.buildTool(tool);
|
|
127
|
-
return acc;
|
|
128
|
-
},
|
|
129
|
-
{}
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
tools = {};
|
|
133
|
-
// public getTools() {
|
|
134
|
-
// return this.tools
|
|
135
|
-
// }
|
|
136
|
-
async callMethod(methodName, args) {
|
|
137
|
-
const parts = methodName.split(".");
|
|
138
|
-
const methodKey = parts.pop();
|
|
139
|
-
if (!methodKey) throw new Error("Method name empty");
|
|
140
|
-
let parent = this.client;
|
|
141
|
-
for (const part of parts) parent = parent[part];
|
|
142
|
-
return await parent[methodKey].call(parent, args);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export {
|
|
147
|
-
Toolkit
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=chunk-UF44LGSE.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/toolkit.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n protected readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\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 public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.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 return await parent[methodKey].call(parent, args)\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 received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\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})\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 inboc 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 { z } 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 methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n"],"mappings":";AAAA,SAAS,uBAAuB;;;ACAhC,SAAS,SAAS;AAEX,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AACjF,CAAC;AAEM,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACnC,UAAU,EAAE,OAAO,EAAE,SAAS,4BAA4B;AAC9D,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACtC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,sCAAsC;AAAA,EAC/E,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AAAA,EAC3E,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AAC3F,CAAC;AAEM,IAAM,oBAAoB,gBAAgB,OAAO;AAAA,EACpD,UAAU,EAAE,OAAO,EAAE,SAAS,yCAAyC;AAAA,EACvE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EACjF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,mCAAmC;AAC7E,CAAC;AAE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AA,MACf,CAAC,KAAK,SAAS;AACX,YAAI,KAAK,IAAI,IAAI,KAAK,UAAU,IAAI;AACpC,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAZmB,QAA2B,CAAC;AAAA;AAAA;AAAA;AAAA,EAoB/C,MAAa,WAAW,YAAoB,MAAe;AACvD,UAAM,QAAQ,WAAW,MAAM,GAAG;AAClC,UAAM,YAAY,MAAM,IAAI;AAE5B,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,mBAAmB;AAEnD,QAAI,SAAc,KAAK;AACvB,eAAW,QAAQ,MAAO,UAAS,OAAO,IAAI;AAE9C,WAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;","names":[]}
|
package/dist/chunk-ZPF3SOVL.mjs
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value))
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e)
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value))
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
var step = (x) => (x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected))
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next())
|
|
19
|
-
})
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// src/toolkit.ts
|
|
23
|
-
import { AgentMailClient } from 'agentmail'
|
|
24
|
-
|
|
25
|
-
// src/schemas.ts
|
|
26
|
-
import { z } from 'zod'
|
|
27
|
-
var ListItemsParams = z.object({
|
|
28
|
-
limit: z.number().optional().describe('The maximum number of items to return'),
|
|
29
|
-
last_key: z.string().optional().describe('The last key to use for pagination'),
|
|
30
|
-
})
|
|
31
|
-
var GetInboxParams = z.object({
|
|
32
|
-
inbox_id: z.string().describe('The ID of the inbox to get'),
|
|
33
|
-
})
|
|
34
|
-
var CreateInboxParams = z.object({
|
|
35
|
-
username: z.string().optional().describe('The username of the inbox to create.'),
|
|
36
|
-
domain: z.string().optional().describe('The domain of the inbox to create.'),
|
|
37
|
-
display_name: z.string().optional().describe('The display name of the inbox to create.'),
|
|
38
|
-
})
|
|
39
|
-
var ListThreadsParams = ListItemsParams.extend({
|
|
40
|
-
inbox_id: z.string().describe('The ID of the inbox to list threads for'),
|
|
41
|
-
received: z.boolean().optional().describe('Whether to filter by received threads'),
|
|
42
|
-
sent: z.boolean().optional().describe('Whether to filter by sent threads'),
|
|
43
|
-
})
|
|
44
|
-
var GetThreadParams = z.object({
|
|
45
|
-
inbox_id: z.string().describe('The ID of the inbox to get the thread for'),
|
|
46
|
-
thread_id: z.string().describe('The ID of the thread to get'),
|
|
47
|
-
})
|
|
48
|
-
var ListMessagesParams = ListItemsParams.extend({
|
|
49
|
-
inbox_id: z.string().describe('The ID of the inbox to list messages for'),
|
|
50
|
-
})
|
|
51
|
-
var GetMessageParams = z.object({
|
|
52
|
-
inbox_id: z.string().describe('The ID of the inbox to get the message for'),
|
|
53
|
-
message_id: z.string().describe('The ID of the message to get'),
|
|
54
|
-
})
|
|
55
|
-
var GetAttachmentParams = z.object({
|
|
56
|
-
inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),
|
|
57
|
-
message_id: z.string().describe('The ID of the message to get the attachment for'),
|
|
58
|
-
attachment_id: z.string().describe('The ID of the attachment to get'),
|
|
59
|
-
})
|
|
60
|
-
var SendMessageParams = z.object({
|
|
61
|
-
inbox_id: z.string().describe('The ID of the inbox to send the message from'),
|
|
62
|
-
to: z.array(z.string()).describe('The list of recipients'),
|
|
63
|
-
cc: z.array(z.string()).optional().describe('The list of CC recipients'),
|
|
64
|
-
bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),
|
|
65
|
-
subject: z.string().optional().describe('The subject of the message'),
|
|
66
|
-
text: z.string().optional().describe('The plain text body of the message'),
|
|
67
|
-
html: z.string().optional().describe('The HTML body of the message'),
|
|
68
|
-
})
|
|
69
|
-
var ReplyToMessageParams = z.object({
|
|
70
|
-
inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),
|
|
71
|
-
message_id: z.string().describe('The message ID of the message you wish to reply to'),
|
|
72
|
-
text: z.string().optional().describe('The plain text body of the reply'),
|
|
73
|
-
html: z.string().optional().describe('The HTML body of the reply'),
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
// src/tools.ts
|
|
77
|
-
var tools = [
|
|
78
|
-
{
|
|
79
|
-
name: 'list_inboxes',
|
|
80
|
-
methodName: 'inboxes.list',
|
|
81
|
-
description: 'List all inboxes',
|
|
82
|
-
paramsSchema: ListItemsParams,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: 'get_inbox',
|
|
86
|
-
methodName: 'inboxes.get',
|
|
87
|
-
description: 'Get an inbox by ID',
|
|
88
|
-
paramsSchema: GetInboxParams,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: 'create_inbox',
|
|
92
|
-
methodName: 'inboxes.create',
|
|
93
|
-
description: 'Create a new inbox',
|
|
94
|
-
paramsSchema: CreateInboxParams,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
name: 'list_threads',
|
|
98
|
-
methodName: 'threads.list',
|
|
99
|
-
description: 'List all threads',
|
|
100
|
-
paramsSchema: ListThreadsParams,
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'get_thread',
|
|
104
|
-
methodName: 'threads.get',
|
|
105
|
-
description: 'Get a thread by ID',
|
|
106
|
-
paramsSchema: GetThreadParams,
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: 'list_messages',
|
|
110
|
-
methodName: 'messages.list',
|
|
111
|
-
description: 'List all messages',
|
|
112
|
-
paramsSchema: ListMessagesParams,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
name: 'get_message',
|
|
116
|
-
methodName: 'messages.get',
|
|
117
|
-
description: 'Get a message by ID',
|
|
118
|
-
paramsSchema: GetMessageParams,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: 'get_attachment',
|
|
122
|
-
methodName: 'attachments.get',
|
|
123
|
-
description: 'Get an attachment by ID',
|
|
124
|
-
paramsSchema: GetAttachmentParams,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: 'send_message',
|
|
128
|
-
methodName: 'messages.send',
|
|
129
|
-
description: 'Send a message',
|
|
130
|
-
paramsSchema: SendMessageParams,
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: 'reply_to_message',
|
|
134
|
-
methodName: 'messages.reply',
|
|
135
|
-
description: 'Reply to a message',
|
|
136
|
-
paramsSchema: ReplyToMessageParams,
|
|
137
|
-
},
|
|
138
|
-
]
|
|
139
|
-
|
|
140
|
-
// src/toolkit.ts
|
|
141
|
-
var Toolkit = class {
|
|
142
|
-
constructor(client) {
|
|
143
|
-
this.client = client
|
|
144
|
-
this.tools = {}
|
|
145
|
-
if (!this.client) this.client = new AgentMailClient()
|
|
146
|
-
this.tools = tools.reduce((acc, tool) => {
|
|
147
|
-
acc[tool.name] = this.buildTool(tool)
|
|
148
|
-
return acc
|
|
149
|
-
}, {})
|
|
150
|
-
}
|
|
151
|
-
// public getTools() {
|
|
152
|
-
// return this.tools
|
|
153
|
-
// }
|
|
154
|
-
callMethod(methodName, args) {
|
|
155
|
-
return __async(this, null, function* () {
|
|
156
|
-
const parts = methodName.split('.')
|
|
157
|
-
const methodKey = parts.pop()
|
|
158
|
-
if (!methodKey) throw new Error('Method name empty')
|
|
159
|
-
let parent = this.client
|
|
160
|
-
for (const part of parts) parent = parent[part]
|
|
161
|
-
return yield parent[methodKey].call(parent, args)
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export { __async, Toolkit }
|
|
167
|
-
//# sourceMappingURL=chunk-ZPF3SOVL.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/toolkit.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n protected readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\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 public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.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 return await parent[methodKey].call(parent, args)\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 received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\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})\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 inboc 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 { z } 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 methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,uBAAuB;;;ACAhC,SAAS,SAAS;AAEX,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AACjF,CAAC;AAEM,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACnC,UAAU,EAAE,OAAO,EAAE,SAAS,4BAA4B;AAC9D,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACtC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,sCAAsC;AAAA,EAC/E,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AAAA,EAC3E,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AAC3F,CAAC;AAEM,IAAM,oBAAoB,gBAAgB,OAAO;AAAA,EACpD,UAAU,EAAE,OAAO,EAAE,SAAS,yCAAyC;AAAA,EACvE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EACjF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,mCA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,SAAS,IAAI,gBAAgB;AAEpD,SAAK,QAAQ,MAAM;AAAA,MACf,CAAC,KAAK,SAAS;AACX,YAAI,KAAK,IAAI,IAAI,KAAK,UAAU,IAAI;AACpC,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA,EAQa,WAAW,YAAoB,MAAe;AAAA;AACvD,YAAM,QAAQ,WAAW,MAAM,GAAG;AAClC,YAAM,YAAY,MAAM,IAAI;AAE5B,UAAI,CAAC,UAAW,OAAM,IAAI,MAAM,mBAAmB;AAEnD,UAAI,SAAc,KAAK;AACvB,iBAAW,QAAQ,MAAO,UAAS,OAAO,IAAI;AAE9C,aAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,IACpD;AAAA;AACJ;","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AgentMailClient } from 'agentmail';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
type Tool = {
|
|
5
|
-
name: string;
|
|
6
|
-
methodName: string;
|
|
7
|
-
description: string;
|
|
8
|
-
paramsSchema: z.ZodObject<any>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
declare abstract class Toolkit<T> {
|
|
12
|
-
private readonly client?;
|
|
13
|
-
protected readonly tools: Record<string, T>;
|
|
14
|
-
constructor(client?: AgentMailClient | undefined);
|
|
15
|
-
protected abstract buildTool(tool: Tool): T;
|
|
16
|
-
callMethod(methodName: string, args: unknown): Promise<any>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { Toolkit as T, type Tool as a };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AgentMailClient } from 'agentmail';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
type Tool = {
|
|
5
|
-
name: string;
|
|
6
|
-
methodName: string;
|
|
7
|
-
description: string;
|
|
8
|
-
paramsSchema: z.ZodObject<any>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
declare abstract class Toolkit<T> {
|
|
12
|
-
private readonly client?;
|
|
13
|
-
protected readonly tools: Record<string, T>;
|
|
14
|
-
constructor(client?: AgentMailClient | undefined);
|
|
15
|
-
protected abstract buildTool(tool: Tool): T;
|
|
16
|
-
callMethod(methodName: string, args: unknown): Promise<any>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { Toolkit as T, type Tool as a };
|