chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+164
View File
@@ -0,0 +1,164 @@
import type { CreateDraftParams, CreateDraftResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailCreateDraftTool: ToolConfig<CreateDraftParams, CreateDraftResult> = {
id: 'agentmail_create_draft',
name: 'Create Draft',
description: 'Create a new email draft in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to create the draft in',
},
to: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Recipient email addresses (comma-separated)',
},
subject: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Draft subject line',
},
text: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Plain text draft body',
},
html: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'HTML draft body',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC recipient email addresses (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC recipient email addresses (comma-separated)',
},
inReplyTo: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'ID of message being replied to',
},
sendAt: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'ISO 8601 timestamp to schedule sending',
},
},
request: {
url: (params) => `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/drafts`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, unknown> = {}
if (params.to) body.to = params.to.split(',').map((e) => e.trim())
if (params.subject) body.subject = params.subject
if (params.text) body.text = params.text
if (params.html) body.html = params.html
if (params.cc) body.cc = params.cc.split(',').map((e) => e.trim())
if (params.bcc) body.bcc = params.bcc.split(',').map((e) => e.trim())
if (params.inReplyTo) body.in_reply_to = params.inReplyTo
if (params.sendAt) body.send_at = params.sendAt
return body
},
},
transformResponse: async (response): Promise<CreateDraftResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to create draft',
output: {
draftId: '',
inboxId: '',
subject: null,
to: [],
cc: [],
bcc: [],
text: null,
html: null,
preview: null,
labels: [],
inReplyTo: null,
sendStatus: null,
sendAt: null,
createdAt: '',
updatedAt: '',
},
}
}
return {
success: true,
output: {
draftId: data.draft_id ?? '',
inboxId: data.inbox_id ?? '',
subject: data.subject ?? null,
to: data.to ?? [],
cc: data.cc ?? [],
bcc: data.bcc ?? [],
text: data.text ?? null,
html: data.html ?? null,
preview: data.preview ?? null,
labels: data.labels ?? [],
inReplyTo: data.in_reply_to ?? null,
sendStatus: data.send_status ?? null,
sendAt: data.send_at ?? null,
createdAt: data.created_at ?? '',
updatedAt: data.updated_at ?? '',
},
}
},
outputs: {
draftId: { type: 'string', description: 'Unique identifier for the draft' },
inboxId: { type: 'string', description: 'Inbox the draft belongs to' },
subject: { type: 'string', description: 'Draft subject', optional: true },
to: { type: 'array', description: 'Recipient email addresses' },
cc: { type: 'array', description: 'CC email addresses' },
bcc: { type: 'array', description: 'BCC email addresses' },
text: { type: 'string', description: 'Plain text content', optional: true },
html: { type: 'string', description: 'HTML content', optional: true },
preview: { type: 'string', description: 'Draft preview text', optional: true },
labels: { type: 'array', description: 'Labels assigned to the draft' },
inReplyTo: { type: 'string', description: 'Message ID this draft replies to', optional: true },
sendStatus: {
type: 'string',
description: 'Send status (scheduled, sending, failed)',
optional: true,
},
sendAt: { type: 'string', description: 'Scheduled send time', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
}
+87
View File
@@ -0,0 +1,87 @@
import type { CreateInboxParams, CreateInboxResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailCreateInboxTool: ToolConfig<CreateInboxParams, CreateInboxResult> = {
id: 'agentmail_create_inbox',
name: 'Create Inbox',
description: 'Create a new email inbox with AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
username: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Username for the inbox email address',
},
domain: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Domain for the inbox email address',
},
displayName: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Display name for the inbox',
},
},
request: {
url: 'https://api.agentmail.to/v0/inboxes',
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => ({
...(params.username && { username: params.username }),
...(params.domain && { domain: params.domain }),
...(params.displayName && { display_name: params.displayName }),
}),
},
transformResponse: async (response): Promise<CreateInboxResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to create inbox',
output: {
inboxId: '',
email: '',
displayName: null,
createdAt: '',
updatedAt: '',
},
}
}
return {
success: true,
output: {
inboxId: data.inbox_id ?? '',
email: data.email ?? '',
displayName: data.display_name ?? null,
createdAt: data.created_at ?? '',
updatedAt: data.updated_at ?? '',
},
}
},
outputs: {
inboxId: { type: 'string', description: 'Unique identifier for the inbox' },
email: { type: 'string', description: 'Email address of the inbox' },
displayName: { type: 'string', description: 'Display name of the inbox', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
}
+59
View File
@@ -0,0 +1,59 @@
import type { DeleteDraftParams, DeleteDraftResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailDeleteDraftTool: ToolConfig<DeleteDraftParams, DeleteDraftResult> = {
id: 'agentmail_delete_draft',
name: 'Delete Draft',
description: 'Delete an email draft in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the draft',
},
draftId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the draft to delete',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/drafts/${params.draftId.trim()}`,
method: 'DELETE',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<DeleteDraftResult> => {
if (!response.ok) {
const data = await response.json()
return {
success: false,
error: data.message ?? 'Failed to delete draft',
output: { deleted: false },
}
}
return {
success: true,
output: { deleted: true },
}
},
outputs: {
deleted: { type: 'boolean', description: 'Whether the draft was successfully deleted' },
},
}
+52
View File
@@ -0,0 +1,52 @@
import type { DeleteInboxParams, DeleteInboxResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailDeleteInboxTool: ToolConfig<DeleteInboxParams, DeleteInboxResult> = {
id: 'agentmail_delete_inbox',
name: 'Delete Inbox',
description: 'Delete an email inbox in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to delete',
},
},
request: {
url: (params) => `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}`,
method: 'DELETE',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<DeleteInboxResult> => {
if (!response.ok) {
const data = await response.json()
return {
success: false,
error: data.message ?? 'Failed to delete inbox',
output: { deleted: false },
}
}
return {
success: true,
output: { deleted: true },
}
},
outputs: {
deleted: { type: 'boolean', description: 'Whether the inbox was successfully deleted' },
},
}
+70
View File
@@ -0,0 +1,70 @@
import type { DeleteThreadParams, DeleteThreadResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailDeleteThreadTool: ToolConfig<DeleteThreadParams, DeleteThreadResult> = {
id: 'agentmail_delete_thread',
name: 'Delete Thread',
description:
'Delete an email thread in AgentMail (moves to trash, or permanently deletes if already in trash)',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the thread',
},
threadId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the thread to delete',
},
permanent: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Force permanent deletion instead of moving to trash',
},
},
request: {
url: (params) => {
const query = new URLSearchParams()
if (params.permanent) query.set('permanent', 'true')
const qs = query.toString()
return `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/threads/${params.threadId.trim()}${qs ? `?${qs}` : ''}`
},
method: 'DELETE',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<DeleteThreadResult> => {
if (!response.ok) {
const data = await response.json()
return {
success: false,
error: data.message ?? 'Failed to delete thread',
output: { deleted: false },
}
}
return {
success: true,
output: { deleted: true },
}
},
outputs: {
deleted: { type: 'boolean', description: 'Whether the thread was successfully deleted' },
},
}
+112
View File
@@ -0,0 +1,112 @@
import type { ForwardMessageParams, ForwardMessageResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailForwardMessageTool: ToolConfig<ForwardMessageParams, ForwardMessageResult> = {
id: 'agentmail_forward_message',
name: 'Forward Message',
description: 'Forward an email message to new recipients in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the message',
},
messageId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the message to forward',
},
to: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Recipient email addresses (comma-separated)',
},
subject: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Override subject line',
},
text: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Additional plain text to prepend',
},
html: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Additional HTML to prepend',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC recipient email addresses (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC recipient email addresses (comma-separated)',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/messages/${params.messageId.trim()}/forward`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, unknown> = {
to: params.to.split(',').map((e) => e.trim()),
}
if (params.subject) body.subject = params.subject
if (params.text) body.text = params.text
if (params.html) body.html = params.html
if (params.cc) body.cc = params.cc.split(',').map((e) => e.trim())
if (params.bcc) body.bcc = params.bcc.split(',').map((e) => e.trim())
return body
},
},
transformResponse: async (response): Promise<ForwardMessageResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to forward message',
output: { messageId: '', threadId: '' },
}
}
return {
success: true,
output: {
messageId: data.message_id ?? '',
threadId: data.thread_id ?? '',
},
}
},
outputs: {
messageId: { type: 'string', description: 'ID of the forwarded message' },
threadId: { type: 'string', description: 'ID of the thread' },
},
}
+110
View File
@@ -0,0 +1,110 @@
import type { GetDraftParams, GetDraftResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailGetDraftTool: ToolConfig<GetDraftParams, GetDraftResult> = {
id: 'agentmail_get_draft',
name: 'Get Draft',
description: 'Get details of a specific email draft in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox the draft belongs to',
},
draftId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the draft to retrieve',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/drafts/${params.draftId.trim()}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<GetDraftResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to get draft',
output: {
draftId: '',
inboxId: '',
subject: null,
to: [],
cc: [],
bcc: [],
text: null,
html: null,
preview: null,
labels: [],
inReplyTo: null,
sendStatus: null,
sendAt: null,
createdAt: '',
updatedAt: '',
},
}
}
return {
success: true,
output: {
draftId: data.draft_id ?? '',
inboxId: data.inbox_id ?? '',
subject: data.subject ?? null,
to: data.to ?? [],
cc: data.cc ?? [],
bcc: data.bcc ?? [],
text: data.text ?? null,
html: data.html ?? null,
preview: data.preview ?? null,
labels: data.labels ?? [],
inReplyTo: data.in_reply_to ?? null,
sendStatus: data.send_status ?? null,
sendAt: data.send_at ?? null,
createdAt: data.created_at ?? '',
updatedAt: data.updated_at ?? '',
},
}
},
outputs: {
draftId: { type: 'string', description: 'Unique identifier for the draft' },
inboxId: { type: 'string', description: 'Inbox the draft belongs to' },
subject: { type: 'string', description: 'Draft subject', optional: true },
to: { type: 'array', description: 'Recipient email addresses' },
cc: { type: 'array', description: 'CC email addresses' },
bcc: { type: 'array', description: 'BCC email addresses' },
text: { type: 'string', description: 'Plain text content', optional: true },
html: { type: 'string', description: 'HTML content', optional: true },
preview: { type: 'string', description: 'Draft preview text', optional: true },
labels: { type: 'array', description: 'Labels assigned to the draft' },
inReplyTo: { type: 'string', description: 'Message ID this draft replies to', optional: true },
sendStatus: {
type: 'string',
description: 'Send status (scheduled, sending, failed)',
optional: true,
},
sendAt: { type: 'string', description: 'Scheduled send time', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
}
+69
View File
@@ -0,0 +1,69 @@
import type { GetInboxParams, GetInboxResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailGetInboxTool: ToolConfig<GetInboxParams, GetInboxResult> = {
id: 'agentmail_get_inbox',
name: 'Get Inbox',
description: 'Get details of a specific email inbox in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to retrieve',
},
},
request: {
url: (params) => `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<GetInboxResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to get inbox',
output: {
inboxId: '',
email: '',
displayName: null,
createdAt: '',
updatedAt: '',
},
}
}
return {
success: true,
output: {
inboxId: data.inbox_id ?? '',
email: data.email ?? '',
displayName: data.display_name ?? null,
createdAt: data.created_at ?? '',
updatedAt: data.updated_at ?? '',
},
}
},
outputs: {
inboxId: { type: 'string', description: 'Unique identifier for the inbox' },
email: { type: 'string', description: 'Email address of the inbox' },
displayName: { type: 'string', description: 'Display name of the inbox', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
}
+101
View File
@@ -0,0 +1,101 @@
import type { GetMessageParams, GetMessageResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailGetMessageTool: ToolConfig<GetMessageParams, GetMessageResult> = {
id: 'agentmail_get_message',
name: 'Get Message',
description: 'Get details of a specific email message in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the message',
},
messageId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the message to retrieve',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/messages/${params.messageId.trim()}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<GetMessageResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to get message',
output: {
messageId: '',
threadId: '',
from: null,
to: [],
cc: [],
bcc: [],
subject: null,
text: null,
html: null,
labels: [],
timestamp: null,
createdAt: '',
},
}
}
return {
success: true,
output: {
messageId: data.message_id ?? '',
threadId: data.thread_id ?? '',
from: data.from ?? null,
to: data.to ?? [],
cc: data.cc ?? [],
bcc: data.bcc ?? [],
subject: data.subject ?? null,
text: data.text ?? null,
html: data.html ?? null,
labels: data.labels ?? [],
timestamp: data.timestamp ?? null,
createdAt: data.created_at ?? '',
},
}
},
outputs: {
messageId: { type: 'string', description: 'Unique identifier for the message' },
threadId: { type: 'string', description: 'ID of the thread this message belongs to' },
from: { type: 'string', description: 'Sender email address', optional: true },
to: { type: 'array', description: 'Recipient email addresses' },
cc: { type: 'array', description: 'CC email addresses' },
bcc: { type: 'array', description: 'BCC email addresses' },
subject: { type: 'string', description: 'Message subject', optional: true },
text: { type: 'string', description: 'Plain text content', optional: true },
html: { type: 'string', description: 'HTML content', optional: true },
labels: { type: 'array', description: 'Labels assigned to the message' },
timestamp: {
type: 'string',
description: 'Time the message was sent or drafted',
optional: true,
},
createdAt: { type: 'string', description: 'Creation timestamp' },
},
}
+126
View File
@@ -0,0 +1,126 @@
import type { GetThreadParams, GetThreadResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailGetThreadTool: ToolConfig<GetThreadParams, GetThreadResult> = {
id: 'agentmail_get_thread',
name: 'Get Thread',
description: 'Get details of a specific email thread including messages in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the thread',
},
threadId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the thread to retrieve',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/threads/${params.threadId.trim()}`,
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<GetThreadResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to get thread',
output: {
threadId: '',
subject: null,
senders: [],
recipients: [],
messageCount: 0,
labels: [],
lastMessageAt: null,
createdAt: '',
updatedAt: '',
messages: [],
},
}
}
return {
success: true,
output: {
threadId: data.thread_id ?? '',
subject: data.subject ?? null,
senders: data.senders ?? [],
recipients: data.recipients ?? [],
messageCount: data.message_count ?? 0,
labels: data.labels ?? [],
lastMessageAt: data.timestamp ?? null,
createdAt: data.created_at ?? '',
updatedAt: data.updated_at ?? '',
messages: (data.messages ?? []).map((msg: Record<string, unknown>) => ({
messageId: msg.message_id ?? '',
from: (msg.from as string) ?? null,
to: (msg.to as string[]) ?? [],
cc: (msg.cc as string[]) ?? [],
bcc: (msg.bcc as string[]) ?? [],
subject: (msg.subject as string) ?? null,
text: (msg.text as string) ?? null,
html: (msg.html as string) ?? null,
labels: (msg.labels as string[]) ?? [],
timestamp: (msg.timestamp as string) ?? null,
createdAt: (msg.created_at as string) ?? '',
})),
},
}
},
outputs: {
threadId: { type: 'string', description: 'Unique identifier for the thread' },
subject: { type: 'string', description: 'Thread subject', optional: true },
senders: { type: 'array', description: 'List of sender email addresses' },
recipients: { type: 'array', description: 'List of recipient email addresses' },
messageCount: { type: 'number', description: 'Number of messages in the thread' },
labels: { type: 'array', description: 'Labels assigned to the thread' },
lastMessageAt: { type: 'string', description: 'Timestamp of last message', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
messages: {
type: 'array',
description: 'Messages in the thread',
items: {
type: 'object',
properties: {
messageId: { type: 'string', description: 'Unique identifier for the message' },
from: { type: 'string', description: 'Sender email address', optional: true },
to: { type: 'array', description: 'Recipient email addresses' },
cc: { type: 'array', description: 'CC email addresses' },
bcc: { type: 'array', description: 'BCC email addresses' },
subject: { type: 'string', description: 'Message subject', optional: true },
text: { type: 'string', description: 'Plain text content', optional: true },
html: { type: 'string', description: 'HTML content', optional: true },
labels: { type: 'array', description: 'Labels assigned to the message' },
timestamp: {
type: 'string',
description: 'Time the message was sent or drafted',
optional: true,
},
createdAt: { type: 'string', description: 'Creation timestamp' },
},
},
},
},
}
+21
View File
@@ -0,0 +1,21 @@
export { agentmailCreateDraftTool } from '@/tools/agentmail/create_draft'
export { agentmailCreateInboxTool } from '@/tools/agentmail/create_inbox'
export { agentmailDeleteDraftTool } from '@/tools/agentmail/delete_draft'
export { agentmailDeleteInboxTool } from '@/tools/agentmail/delete_inbox'
export { agentmailDeleteThreadTool } from '@/tools/agentmail/delete_thread'
export { agentmailForwardMessageTool } from '@/tools/agentmail/forward_message'
export { agentmailGetDraftTool } from '@/tools/agentmail/get_draft'
export { agentmailGetInboxTool } from '@/tools/agentmail/get_inbox'
export { agentmailGetMessageTool } from '@/tools/agentmail/get_message'
export { agentmailGetThreadTool } from '@/tools/agentmail/get_thread'
export { agentmailListDraftsTool } from '@/tools/agentmail/list_drafts'
export { agentmailListInboxesTool } from '@/tools/agentmail/list_inboxes'
export { agentmailListMessagesTool } from '@/tools/agentmail/list_messages'
export { agentmailListThreadsTool } from '@/tools/agentmail/list_threads'
export { agentmailReplyMessageTool } from '@/tools/agentmail/reply_message'
export { agentmailSendDraftTool } from '@/tools/agentmail/send_draft'
export { agentmailSendMessageTool } from '@/tools/agentmail/send_message'
export { agentmailUpdateDraftTool } from '@/tools/agentmail/update_draft'
export { agentmailUpdateInboxTool } from '@/tools/agentmail/update_inbox'
export { agentmailUpdateMessageTool } from '@/tools/agentmail/update_message'
export { agentmailUpdateThreadTool } from '@/tools/agentmail/update_thread'
+116
View File
@@ -0,0 +1,116 @@
import type { ListDraftsParams, ListDraftsResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailListDraftsTool: ToolConfig<ListDraftsParams, ListDraftsResult> = {
id: 'agentmail_list_drafts',
name: 'List Drafts',
description: 'List email drafts in an inbox in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to list drafts from',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of drafts to return',
},
pageToken: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Pagination token for next page of results',
},
},
request: {
url: (params) => {
const query = new URLSearchParams()
if (params.limit) query.set('limit', String(params.limit))
if (params.pageToken) query.set('page_token', params.pageToken)
const qs = query.toString()
return `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/drafts${qs ? `?${qs}` : ''}`
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<ListDraftsResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to list drafts',
output: { drafts: [], count: 0, nextPageToken: null },
}
}
return {
success: true,
output: {
drafts: (data.drafts ?? []).map((draft: Record<string, unknown>) => ({
draftId: draft.draft_id ?? '',
inboxId: draft.inbox_id ?? '',
subject: (draft.subject as string) ?? null,
to: (draft.to as string[]) ?? [],
cc: (draft.cc as string[]) ?? [],
bcc: (draft.bcc as string[]) ?? [],
preview: (draft.preview as string) ?? null,
sendStatus: (draft.send_status as string) ?? null,
sendAt: (draft.send_at as string) ?? null,
createdAt: (draft.created_at as string) ?? '',
updatedAt: (draft.updated_at as string) ?? '',
})),
count: data.count ?? 0,
nextPageToken: data.next_page_token ?? null,
},
}
},
outputs: {
drafts: {
type: 'array',
description: 'List of drafts',
items: {
type: 'object',
properties: {
draftId: { type: 'string', description: 'Unique identifier for the draft' },
inboxId: { type: 'string', description: 'Inbox the draft belongs to' },
subject: { type: 'string', description: 'Draft subject', optional: true },
to: { type: 'array', description: 'Recipient email addresses' },
cc: { type: 'array', description: 'CC email addresses' },
bcc: { type: 'array', description: 'BCC email addresses' },
preview: { type: 'string', description: 'Draft preview text', optional: true },
sendStatus: {
type: 'string',
description: 'Send status (scheduled, sending, failed)',
optional: true,
},
sendAt: { type: 'string', description: 'Scheduled send time', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
},
},
count: { type: 'number', description: 'Total number of drafts' },
nextPageToken: {
type: 'string',
description: 'Token for retrieving the next page',
optional: true,
},
},
}
+98
View File
@@ -0,0 +1,98 @@
import type { ListInboxesParams, ListInboxesResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailListInboxesTool: ToolConfig<ListInboxesParams, ListInboxesResult> = {
id: 'agentmail_list_inboxes',
name: 'List Inboxes',
description: 'List all email inboxes in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of inboxes to return',
},
pageToken: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Pagination token for next page of results',
},
},
request: {
url: (params) => {
const query = new URLSearchParams()
if (params.limit) query.set('limit', String(params.limit))
if (params.pageToken) query.set('page_token', params.pageToken)
const qs = query.toString()
return `https://api.agentmail.to/v0/inboxes${qs ? `?${qs}` : ''}`
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<ListInboxesResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to list inboxes',
output: { inboxes: [], count: 0, nextPageToken: null },
}
}
return {
success: true,
output: {
inboxes: (data.inboxes ?? []).map((inbox: Record<string, unknown>) => ({
inboxId: inbox.inbox_id ?? '',
email: inbox.email ?? '',
displayName: inbox.display_name ?? null,
createdAt: inbox.created_at ?? '',
updatedAt: inbox.updated_at ?? '',
})),
count: data.count ?? 0,
nextPageToken: data.next_page_token ?? null,
},
}
},
outputs: {
inboxes: {
type: 'array',
description: 'List of inboxes',
items: {
type: 'object',
properties: {
inboxId: { type: 'string', description: 'Unique identifier for the inbox' },
email: { type: 'string', description: 'Email address of the inbox' },
displayName: {
type: 'string',
description: 'Display name of the inbox',
optional: true,
},
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
},
},
count: { type: 'number', description: 'Total number of inboxes' },
nextPageToken: {
type: 'string',
description: 'Token for retrieving the next page',
optional: true,
},
},
}
+108
View File
@@ -0,0 +1,108 @@
import type { ListMessagesParams, ListMessagesResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailListMessagesTool: ToolConfig<ListMessagesParams, ListMessagesResult> = {
id: 'agentmail_list_messages',
name: 'List Messages',
description: 'List messages in an inbox in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to list messages from',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of messages to return',
},
pageToken: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Pagination token for next page of results',
},
},
request: {
url: (params) => {
const query = new URLSearchParams()
if (params.limit) query.set('limit', String(params.limit))
if (params.pageToken) query.set('page_token', params.pageToken)
const qs = query.toString()
return `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/messages${qs ? `?${qs}` : ''}`
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<ListMessagesResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to list messages',
output: { messages: [], count: 0, nextPageToken: null },
}
}
return {
success: true,
output: {
messages: (data.messages ?? []).map((msg: Record<string, unknown>) => ({
messageId: msg.message_id ?? '',
from: (msg.from as string) ?? null,
to: (msg.to as string[]) ?? [],
subject: (msg.subject as string) ?? null,
preview: (msg.preview as string) ?? null,
timestamp: (msg.timestamp as string) ?? null,
createdAt: (msg.created_at as string) ?? '',
})),
count: data.count ?? 0,
nextPageToken: data.next_page_token ?? null,
},
}
},
outputs: {
messages: {
type: 'array',
description: 'List of messages in the inbox',
items: {
type: 'object',
properties: {
messageId: { type: 'string', description: 'Unique identifier for the message' },
from: { type: 'string', description: 'Sender email address', optional: true },
to: { type: 'array', description: 'Recipient email addresses' },
subject: { type: 'string', description: 'Message subject', optional: true },
preview: { type: 'string', description: 'Message preview text', optional: true },
timestamp: {
type: 'string',
description: 'Time the message was sent or drafted',
optional: true,
},
createdAt: { type: 'string', description: 'Creation timestamp' },
},
},
},
count: { type: 'number', description: 'Total number of messages' },
nextPageToken: {
type: 'string',
description: 'Token for retrieving the next page',
optional: true,
},
},
}
+135
View File
@@ -0,0 +1,135 @@
import type { ListThreadsParams, ListThreadsResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailListThreadsTool: ToolConfig<ListThreadsParams, ListThreadsResult> = {
id: 'agentmail_list_threads',
name: 'List Threads',
description: 'List email threads in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to list threads from',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of threads to return',
},
pageToken: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Pagination token for next page of results',
},
labels: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated labels to filter threads by',
},
before: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter threads before this ISO 8601 timestamp',
},
after: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter threads after this ISO 8601 timestamp',
},
},
request: {
url: (params) => {
const query = new URLSearchParams()
if (params.limit) query.set('limit', String(params.limit))
if (params.pageToken) query.set('page_token', params.pageToken)
if (params.labels) {
for (const label of params.labels.split(',')) {
query.append('labels', label.trim())
}
}
if (params.before) query.set('before', params.before)
if (params.after) query.set('after', params.after)
const qs = query.toString()
return `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/threads${qs ? `?${qs}` : ''}`
},
method: 'GET',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response): Promise<ListThreadsResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to list threads',
output: { threads: [], count: 0, nextPageToken: null },
}
}
return {
success: true,
output: {
threads: (data.threads ?? []).map((thread: Record<string, unknown>) => ({
threadId: thread.thread_id ?? '',
subject: (thread.subject as string) ?? null,
senders: (thread.senders as string[]) ?? [],
recipients: (thread.recipients as string[]) ?? [],
messageCount: (thread.message_count as number) ?? 0,
lastMessageAt: (thread.timestamp as string) ?? null,
createdAt: (thread.created_at as string) ?? '',
updatedAt: (thread.updated_at as string) ?? '',
})),
count: data.count ?? 0,
nextPageToken: data.next_page_token ?? null,
},
}
},
outputs: {
threads: {
type: 'array',
description: 'List of email threads',
items: {
type: 'object',
properties: {
threadId: { type: 'string', description: 'Unique identifier for the thread' },
subject: { type: 'string', description: 'Thread subject', optional: true },
senders: { type: 'array', description: 'List of sender email addresses' },
recipients: { type: 'array', description: 'List of recipient email addresses' },
messageCount: { type: 'number', description: 'Number of messages in the thread' },
lastMessageAt: {
type: 'string',
description: 'Timestamp of last message',
optional: true,
},
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
},
},
count: { type: 'number', description: 'Total number of threads' },
nextPageToken: {
type: 'string',
description: 'Token for retrieving the next page',
optional: true,
},
},
}
+115
View File
@@ -0,0 +1,115 @@
import type { ReplyMessageParams, ReplyMessageResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailReplyMessageTool: ToolConfig<ReplyMessageParams, ReplyMessageResult> = {
id: 'agentmail_reply_message',
name: 'Reply to Message',
description: 'Reply to an existing email message in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to reply from',
},
messageId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the message to reply to',
},
text: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Plain text reply body',
},
html: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'HTML reply body',
},
to: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Override recipient email addresses (comma-separated)',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC email addresses (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC email addresses (comma-separated)',
},
replyAll: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Reply to all recipients of the original message',
},
},
request: {
url: (params) => {
const endpoint = params.replyAll ? 'reply-all' : 'reply'
return `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/messages/${params.messageId.trim()}/${endpoint}`
},
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, unknown> = {}
if (params.text) body.text = params.text
if (params.html) body.html = params.html
// /reply-all endpoint auto-determines recipients; only /reply accepts to/cc/bcc
if (!params.replyAll) {
if (params.to) body.to = params.to.split(',').map((e) => e.trim())
if (params.cc) body.cc = params.cc.split(',').map((e) => e.trim())
if (params.bcc) body.bcc = params.bcc.split(',').map((e) => e.trim())
}
return body
},
},
transformResponse: async (response): Promise<ReplyMessageResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to reply to message',
output: { messageId: '', threadId: '' },
}
}
return {
success: true,
output: {
messageId: data.message_id ?? '',
threadId: data.thread_id ?? '',
},
}
},
outputs: {
messageId: { type: 'string', description: 'ID of the sent reply message' },
threadId: { type: 'string', description: 'ID of the thread' },
},
}
+66
View File
@@ -0,0 +1,66 @@
import type { SendDraftParams, SendDraftResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailSendDraftTool: ToolConfig<SendDraftParams, SendDraftResult> = {
id: 'agentmail_send_draft',
name: 'Send Draft',
description: 'Send an existing email draft in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the draft',
},
draftId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the draft to send',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/drafts/${params.draftId.trim()}/send`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: () => ({}),
},
transformResponse: async (response): Promise<SendDraftResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to send draft',
output: { messageId: '', threadId: '' },
}
}
return {
success: true,
output: {
messageId: data.message_id ?? '',
threadId: data.thread_id ?? '',
},
}
},
outputs: {
messageId: { type: 'string', description: 'ID of the sent message' },
threadId: { type: 'string', description: 'ID of the thread' },
},
}
+114
View File
@@ -0,0 +1,114 @@
import type { SendMessageParams, SendMessageResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailSendMessageTool: ToolConfig<SendMessageParams, SendMessageResult> = {
id: 'agentmail_send_message',
name: 'Send Message',
description: 'Send an email message from an AgentMail inbox',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to send from',
},
to: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Recipient email address (comma-separated for multiple)',
},
subject: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email subject line',
},
text: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Plain text email body',
},
html: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'HTML email body',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC recipient email addresses (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC recipient email addresses (comma-separated)',
},
},
request: {
url: (params) => `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/messages/send`,
method: 'POST',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, unknown> = {
to: params.to.split(',').map((e) => e.trim()),
subject: params.subject,
}
if (params.text) body.text = params.text
if (params.html) body.html = params.html
if (params.cc) body.cc = params.cc.split(',').map((e) => e.trim())
if (params.bcc) body.bcc = params.bcc.split(',').map((e) => e.trim())
return body
},
},
transformResponse: async (response, params): Promise<SendMessageResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to send message',
output: {
threadId: '',
messageId: '',
subject: '',
to: '',
},
}
}
return {
success: true,
output: {
threadId: data.thread_id ?? '',
messageId: data.message_id ?? '',
subject: params?.subject ?? '',
to: params?.to ?? '',
},
}
},
outputs: {
threadId: { type: 'string', description: 'ID of the created thread' },
messageId: { type: 'string', description: 'ID of the sent message' },
subject: { type: 'string', description: 'Email subject line' },
to: { type: 'string', description: 'Recipient email address' },
},
}
+452
View File
@@ -0,0 +1,452 @@
import type { ToolResponse } from '@/tools/types'
/** Create Inbox */
export interface CreateInboxParams {
apiKey: string
username?: string
domain?: string
displayName?: string
}
export interface CreateInboxResult extends ToolResponse {
output: {
inboxId: string
email: string
displayName: string | null
createdAt: string
updatedAt: string
}
}
/** List Inboxes */
export interface ListInboxesParams {
apiKey: string
limit?: number
pageToken?: string
}
export interface ListInboxesResult extends ToolResponse {
output: {
inboxes: Array<{
inboxId: string
email: string
displayName: string | null
createdAt: string
updatedAt: string
}>
count: number
nextPageToken: string | null
}
}
/** Get Inbox */
export interface GetInboxParams {
apiKey: string
inboxId: string
}
export interface GetInboxResult extends ToolResponse {
output: {
inboxId: string
email: string
displayName: string | null
createdAt: string
updatedAt: string
}
}
/** Update Inbox */
export interface UpdateInboxParams {
apiKey: string
inboxId: string
displayName: string
}
export interface UpdateInboxResult extends ToolResponse {
output: {
inboxId: string
email: string
displayName: string | null
createdAt: string
updatedAt: string
}
}
/** Delete Inbox */
export interface DeleteInboxParams {
apiKey: string
inboxId: string
}
export interface DeleteInboxResult extends ToolResponse {
output: {
deleted: boolean
}
}
/** Send Message (Create Thread) */
export interface SendMessageParams {
apiKey: string
inboxId: string
to: string
subject: string
text?: string
html?: string
cc?: string
bcc?: string
}
export interface SendMessageResult extends ToolResponse {
output: {
threadId: string
messageId: string
subject: string
to: string
}
}
/** Reply to Message */
export interface ReplyMessageParams {
apiKey: string
inboxId: string
messageId: string
text?: string
html?: string
to?: string
cc?: string
bcc?: string
replyAll?: boolean
}
export interface ReplyMessageResult extends ToolResponse {
output: {
messageId: string
threadId: string
}
}
/** Forward Message */
export interface ForwardMessageParams {
apiKey: string
inboxId: string
messageId: string
to: string
subject?: string
text?: string
html?: string
cc?: string
bcc?: string
}
export interface ForwardMessageResult extends ToolResponse {
output: {
messageId: string
threadId: string
}
}
/** Update Message Labels */
export interface UpdateMessageParams {
apiKey: string
inboxId: string
messageId: string
addLabels?: string
removeLabels?: string
}
export interface UpdateMessageResult extends ToolResponse {
output: {
messageId: string
labels: string[]
}
}
/** Create Draft */
export interface CreateDraftParams {
apiKey: string
inboxId: string
to?: string
subject?: string
text?: string
html?: string
cc?: string
bcc?: string
inReplyTo?: string
sendAt?: string
}
export interface CreateDraftResult extends ToolResponse {
output: {
draftId: string
inboxId: string
subject: string | null
to: string[]
cc: string[]
bcc: string[]
text: string | null
html: string | null
preview: string | null
labels: string[]
inReplyTo: string | null
sendStatus: string | null
sendAt: string | null
createdAt: string
updatedAt: string
}
}
/** Update Draft */
export interface UpdateDraftParams {
apiKey: string
inboxId: string
draftId: string
to?: string
subject?: string
text?: string
html?: string
cc?: string
bcc?: string
sendAt?: string
}
export interface UpdateDraftResult extends ToolResponse {
output: {
draftId: string
inboxId: string
subject: string | null
to: string[]
cc: string[]
bcc: string[]
text: string | null
html: string | null
preview: string | null
labels: string[]
inReplyTo: string | null
sendStatus: string | null
sendAt: string | null
createdAt: string
updatedAt: string
}
}
/** Delete Draft */
export interface DeleteDraftParams {
apiKey: string
inboxId: string
draftId: string
}
export interface DeleteDraftResult extends ToolResponse {
output: {
deleted: boolean
}
}
/** Send Draft */
export interface SendDraftParams {
apiKey: string
inboxId: string
draftId: string
}
export interface SendDraftResult extends ToolResponse {
output: {
messageId: string
threadId: string
}
}
/** List Drafts */
export interface ListDraftsParams {
apiKey: string
inboxId: string
limit?: number
pageToken?: string
}
export interface ListDraftsResult extends ToolResponse {
output: {
drafts: Array<{
draftId: string
inboxId: string
subject: string | null
to: string[]
cc: string[]
bcc: string[]
preview: string | null
sendStatus: string | null
sendAt: string | null
createdAt: string
updatedAt: string
}>
count: number
nextPageToken: string | null
}
}
/** Get Draft */
export interface GetDraftParams {
apiKey: string
inboxId: string
draftId: string
}
export interface GetDraftResult extends ToolResponse {
output: {
draftId: string
inboxId: string
subject: string | null
to: string[]
cc: string[]
bcc: string[]
text: string | null
html: string | null
preview: string | null
labels: string[]
inReplyTo: string | null
sendStatus: string | null
sendAt: string | null
createdAt: string
updatedAt: string
}
}
/** List Threads */
export interface ListThreadsParams {
apiKey: string
inboxId: string
limit?: number
pageToken?: string
labels?: string
before?: string
after?: string
}
export interface ListThreadsResult extends ToolResponse {
output: {
threads: Array<{
threadId: string
subject: string | null
senders: string[]
recipients: string[]
messageCount: number
lastMessageAt: string | null
createdAt: string
updatedAt: string
}>
count: number
nextPageToken: string | null
}
}
/** Get Thread */
export interface GetThreadParams {
apiKey: string
inboxId: string
threadId: string
}
export interface GetThreadResult extends ToolResponse {
output: {
threadId: string
subject: string | null
senders: string[]
recipients: string[]
messageCount: number
labels: string[]
lastMessageAt: string | null
createdAt: string
updatedAt: string
messages: Array<{
messageId: string
from: string | null
to: string[]
cc: string[]
bcc: string[]
subject: string | null
text: string | null
html: string | null
labels: string[]
timestamp: string | null
createdAt: string
}>
}
}
/** Update Thread Labels */
export interface UpdateThreadParams {
apiKey: string
inboxId: string
threadId: string
addLabels?: string
removeLabels?: string
}
export interface UpdateThreadResult extends ToolResponse {
output: {
threadId: string
labels: string[]
}
}
/** Delete Thread */
export interface DeleteThreadParams {
apiKey: string
inboxId: string
threadId: string
permanent?: boolean
}
export interface DeleteThreadResult extends ToolResponse {
output: {
deleted: boolean
}
}
/** List Messages */
export interface ListMessagesParams {
apiKey: string
inboxId: string
limit?: number
pageToken?: string
}
export interface ListMessagesResult extends ToolResponse {
output: {
messages: Array<{
messageId: string
from: string | null
to: string[]
subject: string | null
preview: string | null
timestamp: string | null
createdAt: string
}>
count: number
nextPageToken: string | null
}
}
/** Get Message */
export interface GetMessageParams {
apiKey: string
inboxId: string
messageId: string
}
export interface GetMessageResult extends ToolResponse {
output: {
messageId: string
threadId: string
from: string | null
to: string[]
cc: string[]
bcc: string[]
subject: string | null
text: string | null
html: string | null
labels: string[]
timestamp: string | null
createdAt: string
}
}
+164
View File
@@ -0,0 +1,164 @@
import type { UpdateDraftParams, UpdateDraftResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailUpdateDraftTool: ToolConfig<UpdateDraftParams, UpdateDraftResult> = {
id: 'agentmail_update_draft',
name: 'Update Draft',
description: 'Update an existing email draft in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the draft',
},
draftId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the draft to update',
},
to: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Recipient email addresses (comma-separated)',
},
subject: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Draft subject line',
},
text: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Plain text draft body',
},
html: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'HTML draft body',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC recipient email addresses (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC recipient email addresses (comma-separated)',
},
sendAt: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'ISO 8601 timestamp to schedule sending',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/drafts/${params.draftId.trim()}`,
method: 'PATCH',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, unknown> = {}
if (params.to) body.to = params.to.split(',').map((e) => e.trim())
if (params.subject) body.subject = params.subject
if (params.text) body.text = params.text
if (params.html) body.html = params.html
if (params.cc) body.cc = params.cc.split(',').map((e) => e.trim())
if (params.bcc) body.bcc = params.bcc.split(',').map((e) => e.trim())
if (params.sendAt) body.send_at = params.sendAt
return body
},
},
transformResponse: async (response): Promise<UpdateDraftResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to update draft',
output: {
draftId: '',
inboxId: '',
subject: null,
to: [],
cc: [],
bcc: [],
text: null,
html: null,
preview: null,
labels: [],
inReplyTo: null,
sendStatus: null,
sendAt: null,
createdAt: '',
updatedAt: '',
},
}
}
return {
success: true,
output: {
draftId: data.draft_id ?? '',
inboxId: data.inbox_id ?? '',
subject: data.subject ?? null,
to: data.to ?? [],
cc: data.cc ?? [],
bcc: data.bcc ?? [],
text: data.text ?? null,
html: data.html ?? null,
preview: data.preview ?? null,
labels: data.labels ?? [],
inReplyTo: data.in_reply_to ?? null,
sendStatus: data.send_status ?? null,
sendAt: data.send_at ?? null,
createdAt: data.created_at ?? '',
updatedAt: data.updated_at ?? '',
},
}
},
outputs: {
draftId: { type: 'string', description: 'Unique identifier for the draft' },
inboxId: { type: 'string', description: 'Inbox the draft belongs to' },
subject: { type: 'string', description: 'Draft subject', optional: true },
to: { type: 'array', description: 'Recipient email addresses' },
cc: { type: 'array', description: 'CC email addresses' },
bcc: { type: 'array', description: 'BCC email addresses' },
text: { type: 'string', description: 'Plain text content', optional: true },
html: { type: 'string', description: 'HTML content', optional: true },
preview: { type: 'string', description: 'Draft preview text', optional: true },
labels: { type: 'array', description: 'Labels assigned to the draft' },
inReplyTo: { type: 'string', description: 'Message ID this draft replies to', optional: true },
sendStatus: {
type: 'string',
description: 'Send status (scheduled, sending, failed)',
optional: true,
},
sendAt: { type: 'string', description: 'Scheduled send time', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
}
+79
View File
@@ -0,0 +1,79 @@
import type { UpdateInboxParams, UpdateInboxResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailUpdateInboxTool: ToolConfig<UpdateInboxParams, UpdateInboxResult> = {
id: 'agentmail_update_inbox',
name: 'Update Inbox',
description: 'Update the display name of an email inbox in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox to update',
},
displayName: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'New display name for the inbox',
},
},
request: {
url: (params) => `https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}`,
method: 'PATCH',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => ({
display_name: params.displayName,
}),
},
transformResponse: async (response): Promise<UpdateInboxResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to update inbox',
output: {
inboxId: '',
email: '',
displayName: null,
createdAt: '',
updatedAt: '',
},
}
}
return {
success: true,
output: {
inboxId: data.inbox_id ?? '',
email: data.email ?? '',
displayName: data.display_name ?? null,
createdAt: data.created_at ?? '',
updatedAt: data.updated_at ?? '',
},
}
},
outputs: {
inboxId: { type: 'string', description: 'Unique identifier for the inbox' },
email: { type: 'string', description: 'Email address of the inbox' },
displayName: { type: 'string', description: 'Display name of the inbox', optional: true },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last updated timestamp' },
},
}
@@ -0,0 +1,87 @@
import type { UpdateMessageParams, UpdateMessageResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailUpdateMessageTool: ToolConfig<UpdateMessageParams, UpdateMessageResult> = {
id: 'agentmail_update_message',
name: 'Update Message',
description: 'Add or remove labels on an email message in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the message',
},
messageId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the message to update',
},
addLabels: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated labels to add to the message',
},
removeLabels: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated labels to remove from the message',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/messages/${params.messageId.trim()}`,
method: 'PATCH',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, unknown> = {}
if (params.addLabels) {
body.add_labels = params.addLabels.split(',').map((l) => l.trim())
}
if (params.removeLabels) {
body.remove_labels = params.removeLabels.split(',').map((l) => l.trim())
}
return body
},
},
transformResponse: async (response): Promise<UpdateMessageResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to update message',
output: { messageId: '', labels: [] },
}
}
return {
success: true,
output: {
messageId: data.message_id ?? '',
labels: data.labels ?? [],
},
}
},
outputs: {
messageId: { type: 'string', description: 'Unique identifier for the message' },
labels: { type: 'array', description: 'Current labels on the message' },
},
}
+85
View File
@@ -0,0 +1,85 @@
import type { UpdateThreadParams, UpdateThreadResult } from '@/tools/agentmail/types'
import type { ToolConfig } from '@/tools/types'
export const agentmailUpdateThreadTool: ToolConfig<UpdateThreadParams, UpdateThreadResult> = {
id: 'agentmail_update_thread',
name: 'Update Thread Labels',
description: 'Add or remove labels on an email thread in AgentMail',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'AgentMail API key',
},
inboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the inbox containing the thread',
},
threadId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the thread to update',
},
addLabels: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated labels to add to the thread',
},
removeLabels: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated labels to remove from the thread',
},
},
request: {
url: (params) =>
`https://api.agentmail.to/v0/inboxes/${params.inboxId.trim()}/threads/${params.threadId.trim()}`,
method: 'PATCH',
headers: (params) => ({
Authorization: `Bearer ${params.apiKey}`,
'Content-Type': 'application/json',
}),
body: (params) => ({
...(params.addLabels && {
add_labels: params.addLabels.split(',').map((l) => l.trim()),
}),
...(params.removeLabels && {
remove_labels: params.removeLabels.split(',').map((l) => l.trim()),
}),
}),
},
transformResponse: async (response): Promise<UpdateThreadResult> => {
const data = await response.json()
if (!response.ok) {
return {
success: false,
error: data.message ?? 'Failed to update thread',
output: { threadId: '', labels: [] },
}
}
return {
success: true,
output: {
threadId: data.thread_id ?? '',
labels: data.labels ?? [],
},
}
},
outputs: {
threadId: { type: 'string', description: 'Unique identifier for the thread' },
labels: { type: 'array', description: 'Current labels on the thread' },
},
}