-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathdelete.ts
More file actions
77 lines (69 loc) · 1.84 KB
/
delete.ts
File metadata and controls
77 lines (69 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import type { GmailMarkReadParams, GmailToolResponse } from '@/tools/gmail/types'
import type { ToolConfig } from '@/tools/types'
export const gmailDeleteTool: ToolConfig<GmailMarkReadParams, GmailToolResponse> = {
id: 'gmail_delete',
name: 'Gmail Delete',
description: 'Delete a Gmail message (move to trash)',
version: '1.0.0',
oauth: {
required: true,
provider: 'google-email',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'Access token for Gmail API',
},
messageId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the message to delete',
},
},
request: {
url: '/api/tools/gmail/delete',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params: GmailMarkReadParams) => ({
accessToken: params.accessToken,
messageId: params.messageId,
}),
},
transformResponse: async (response) => {
const data = await response.json()
if (!data.success) {
return {
success: false,
output: {
content: data.error || 'Failed to delete email',
metadata: {},
},
error: data.error,
}
}
return {
success: true,
output: {
content: data.output.content,
metadata: data.output.metadata,
},
}
},
outputs: {
content: { type: 'string', description: 'Success message' },
metadata: {
type: 'object',
description: 'Email metadata',
properties: {
id: { type: 'string', description: 'Gmail message ID' },
threadId: { type: 'string', description: 'Gmail thread ID' },
labelIds: { type: 'array', items: { type: 'string' }, description: 'Updated email labels' },
},
},
},
}