bn-google-workspace-mcp-server 0.0.1
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/README.md +718 -0
- package/dist/debug-middleware.d.ts +12 -0
- package/dist/debug-middleware.d.ts.map +1 -0
- package/dist/debug-middleware.js +36 -0
- package/dist/debug-middleware.js.map +1 -0
- package/dist/google-api-client.d.ts +46 -0
- package/dist/google-api-client.d.ts.map +1 -0
- package/dist/google-api-client.js +76 -0
- package/dist/google-api-client.js.map +1 -0
- package/dist/helpers.d.ts +40 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +171 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +166 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +303 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +611 -0
- package/dist/schemas.js.map +1 -0
- package/dist/tool-loader.d.ts +35 -0
- package/dist/tool-loader.d.ts.map +1 -0
- package/dist/tool-loader.js +121 -0
- package/dist/tool-loader.js.map +1 -0
- package/dist/tool-registry.d.ts +44 -0
- package/dist/tool-registry.d.ts.map +1 -0
- package/dist/tool-registry.js +56 -0
- package/dist/tool-registry.js.map +1 -0
- package/dist/tools/calendar.d.ts +44 -0
- package/dist/tools/calendar.d.ts.map +1 -0
- package/dist/tools/calendar.js +76 -0
- package/dist/tools/calendar.js.map +1 -0
- package/dist/tools/chat.d.ts +29 -0
- package/dist/tools/chat.d.ts.map +1 -0
- package/dist/tools/chat.js +42 -0
- package/dist/tools/chat.js.map +1 -0
- package/dist/tools/docs.d.ts +29 -0
- package/dist/tools/docs.d.ts.map +1 -0
- package/dist/tools/docs.js +63 -0
- package/dist/tools/docs.js.map +1 -0
- package/dist/tools/drive.d.ts +45 -0
- package/dist/tools/drive.d.ts.map +1 -0
- package/dist/tools/drive.js +135 -0
- package/dist/tools/drive.js.map +1 -0
- package/dist/tools/forms.d.ts +30 -0
- package/dist/tools/forms.d.ts.map +1 -0
- package/dist/tools/forms.js +46 -0
- package/dist/tools/forms.js.map +1 -0
- package/dist/tools/gmail.d.ts +55 -0
- package/dist/tools/gmail.d.ts.map +1 -0
- package/dist/tools/gmail.js +112 -0
- package/dist/tools/gmail.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +22 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/sheets.d.ts +40 -0
- package/dist/tools/sheets.d.ts.map +1 -0
- package/dist/tools/sheets.js +64 -0
- package/dist/tools/sheets.js.map +1 -0
- package/dist/tools/slides.d.ts +32 -0
- package/dist/tools/slides.d.ts.map +1 -0
- package/dist/tools/slides.js +46 -0
- package/dist/tools/slides.js.map +1 -0
- package/dist/tools/tasks.d.ts +43 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +69 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/types.d.ts +110 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
- package/tools.json +379 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Drive tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import { getDriveService } from "../google-api-client.js";
|
|
5
|
+
import { Readable } from "stream";
|
|
6
|
+
/**
|
|
7
|
+
* List Google Drive files
|
|
8
|
+
*/
|
|
9
|
+
export async function driveListFiles(req, args) {
|
|
10
|
+
const drive = getDriveService(req);
|
|
11
|
+
const { query = "", maxResults = 10 } = args;
|
|
12
|
+
// Build query - check if it's a full query or simple search term
|
|
13
|
+
let q;
|
|
14
|
+
if (query) {
|
|
15
|
+
// Query operators that indicate a full Drive query
|
|
16
|
+
const queryOperators = [
|
|
17
|
+
" contains ",
|
|
18
|
+
" = ",
|
|
19
|
+
" != ",
|
|
20
|
+
" < ",
|
|
21
|
+
" > ",
|
|
22
|
+
" <= ",
|
|
23
|
+
" >= ",
|
|
24
|
+
" in ",
|
|
25
|
+
" and ",
|
|
26
|
+
" or ",
|
|
27
|
+
" not ",
|
|
28
|
+
"mimeType",
|
|
29
|
+
"modifiedTime",
|
|
30
|
+
"createdTime",
|
|
31
|
+
"viewedByMeTime",
|
|
32
|
+
"sharedWithMe",
|
|
33
|
+
"starred",
|
|
34
|
+
"trashed",
|
|
35
|
+
"fullText",
|
|
36
|
+
"parents",
|
|
37
|
+
"owners",
|
|
38
|
+
"writers",
|
|
39
|
+
"readers",
|
|
40
|
+
];
|
|
41
|
+
// Check if query contains any operators (case-insensitive for keywords)
|
|
42
|
+
const isFullQuery = queryOperators.some((op) => query.toLowerCase().includes(op.toLowerCase()));
|
|
43
|
+
if (isFullQuery) {
|
|
44
|
+
// Use the query as-is for full Drive Query Language queries
|
|
45
|
+
q = query;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Simple search term - wrap with name contains
|
|
49
|
+
q = `name contains '${query.replace(/'/g, "\\'")}'`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const response = await drive.files.list({
|
|
53
|
+
pageSize: maxResults,
|
|
54
|
+
fields: "files(id,name,mimeType,modifiedTime,size,webViewLink)",
|
|
55
|
+
q,
|
|
56
|
+
});
|
|
57
|
+
const files = response.data.files || [];
|
|
58
|
+
return {
|
|
59
|
+
success: true,
|
|
60
|
+
files: files.map((file) => ({
|
|
61
|
+
id: file.id,
|
|
62
|
+
name: file.name,
|
|
63
|
+
mimeType: file.mimeType,
|
|
64
|
+
modifiedTime: file.modifiedTime,
|
|
65
|
+
size: file.size,
|
|
66
|
+
webViewLink: file.webViewLink,
|
|
67
|
+
})),
|
|
68
|
+
query: q || "",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get Google Drive file content
|
|
73
|
+
*/
|
|
74
|
+
export async function driveGetFileContent(req, args) {
|
|
75
|
+
const drive = getDriveService(req);
|
|
76
|
+
const { fileId } = args;
|
|
77
|
+
// First get file metadata
|
|
78
|
+
const fileMetadata = await drive.files.get({
|
|
79
|
+
fileId,
|
|
80
|
+
fields: "id,name,mimeType",
|
|
81
|
+
});
|
|
82
|
+
// Download file content
|
|
83
|
+
const response = await drive.files.get({
|
|
84
|
+
fileId,
|
|
85
|
+
alt: "media",
|
|
86
|
+
}, { responseType: "stream" });
|
|
87
|
+
// Read stream to buffer
|
|
88
|
+
const chunks = [];
|
|
89
|
+
const stream = response.data;
|
|
90
|
+
for await (const chunk of stream) {
|
|
91
|
+
chunks.push(Buffer.from(chunk));
|
|
92
|
+
}
|
|
93
|
+
const content = Buffer.concat(chunks).toString("utf-8");
|
|
94
|
+
return {
|
|
95
|
+
success: true,
|
|
96
|
+
file: {
|
|
97
|
+
id: fileMetadata.data.id,
|
|
98
|
+
name: fileMetadata.data.name,
|
|
99
|
+
mimeType: fileMetadata.data.mimeType,
|
|
100
|
+
content,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create a Google Drive file
|
|
106
|
+
*/
|
|
107
|
+
export async function driveCreateFile(req, args) {
|
|
108
|
+
const drive = getDriveService(req);
|
|
109
|
+
const { name, content, parentFolderId } = args;
|
|
110
|
+
// Prepare file metadata
|
|
111
|
+
const fileMetadata = { name };
|
|
112
|
+
if (parentFolderId) {
|
|
113
|
+
fileMetadata.parents = [parentFolderId];
|
|
114
|
+
}
|
|
115
|
+
// Create readable stream from content
|
|
116
|
+
const stream = Readable.from([content]);
|
|
117
|
+
// Create the file
|
|
118
|
+
const file = await drive.files.create({
|
|
119
|
+
requestBody: fileMetadata,
|
|
120
|
+
media: {
|
|
121
|
+
mimeType: "text/plain",
|
|
122
|
+
body: stream,
|
|
123
|
+
},
|
|
124
|
+
fields: "id,name,webViewLink",
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
success: true,
|
|
128
|
+
file: {
|
|
129
|
+
id: file.data.id,
|
|
130
|
+
name: file.data.name,
|
|
131
|
+
webViewLink: file.data.webViewLink,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=drive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../src/tools/drive.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM1D,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAY,EACZ,IAA0C;IAE1C,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC;IAE7C,iEAAiE;IACjE,IAAI,CAAqB,CAAC;IAC1B,IAAI,KAAK,EAAE,CAAC;QACV,mDAAmD;QACnD,MAAM,cAAc,GAAG;YACrB,YAAY;YACZ,KAAK;YACL,MAAM;YACN,KAAK;YACL,KAAK;YACL,MAAM;YACN,MAAM;YACN,MAAM;YACN,OAAO;YACP,MAAM;YACN,OAAO;YACP,UAAU;YACV,cAAc;YACd,aAAa;YACb,gBAAgB;YAChB,cAAc;YACd,SAAS;YACT,SAAS;YACT,UAAU;YACV,SAAS;YACT,QAAQ;YACR,SAAS;YACT,SAAS;SACV,CAAC;QAEF,wEAAwE;QACxE,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAC7C,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAC/C,CAAC;QAEF,IAAI,WAAW,EAAE,CAAC;YAChB,4DAA4D;YAC5D,CAAC,GAAG,KAAK,CAAC;QACZ,CAA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AM;SACb;QACD,MAAM,EAAE,qBAAqB;KAC9B,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI,EAAE;YACJ,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;YACpB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW;SACnC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Forms tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import type { Request } from "express";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
import type { FormsCreateFormSchema, FormsGetFormSchema } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* Create a new Google Form
|
|
9
|
+
*/
|
|
10
|
+
export declare function formsCreateForm(req: Request, args: z.infer<typeof FormsCreateFormSchema>): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
form: {
|
|
13
|
+
formId: string | null | undefined;
|
|
14
|
+
responderUri: string | null | undefined;
|
|
15
|
+
title: string | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Get Google Form information
|
|
20
|
+
*/
|
|
21
|
+
export declare function formsGetForm(req: Request, args: z.infer<typeof FormsGetFormSchema>): Promise<{
|
|
22
|
+
success: boolean;
|
|
23
|
+
form: {
|
|
24
|
+
formId: string | null | undefined;
|
|
25
|
+
title: string | null | undefined;
|
|
26
|
+
description: string;
|
|
27
|
+
responderUri: string | null | undefined;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=forms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/tools/forms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EACV,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;;;;;GAqB5C;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC;;;;;;;;GAkBzC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Forms tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import { getFormsService } from "../google-api-client.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create a new Google Form
|
|
7
|
+
*/
|
|
8
|
+
export async function formsCreateForm(req, args) {
|
|
9
|
+
const forms = getFormsService(req);
|
|
10
|
+
const { title } = args;
|
|
11
|
+
const created = await forms.forms.create({
|
|
12
|
+
requestBody: {
|
|
13
|
+
info: {
|
|
14
|
+
title,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
form: {
|
|
21
|
+
formId: created.data.formId,
|
|
22
|
+
responderUri: created.data.responderUri,
|
|
23
|
+
title: created.data.info?.title,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get Google Form information
|
|
29
|
+
*/
|
|
30
|
+
export async function formsGetForm(req, args) {
|
|
31
|
+
const forms = getFormsService(req);
|
|
32
|
+
const { formId } = args;
|
|
33
|
+
const form = await forms.forms.get({
|
|
34
|
+
formId,
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
success: true,
|
|
38
|
+
form: {
|
|
39
|
+
formId: form.data.formId,
|
|
40
|
+
title: form.data.info?.title,
|
|
41
|
+
description: form.data.info?.description || "",
|
|
42
|
+
responderUri: form.data.responderUri,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=forms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.js","sourceRoot":"","sources":["../../src/tools/forms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM1D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAY,EACZ,IAA2C;IAE3C,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAEvB,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC;QACvC,WAAW,EAAE;YACX,IAAI,EAAE;gBACJ,KAAK;aACN;SACF;KACF,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI,EAAE;YACJ,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM;YAC3B,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;YACvC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK;SAChC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,GAAY,EACZ,IAAwC;IAExC,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;QACjC,MAAM;KACP,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI,EAAE;YACJ,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;YACxB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK;YAC5B,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,IAAI,EAAE;YAC9C,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;SACrC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gmail tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import type { Request } from "express";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
import type { GmailListLabelsSchema, GmailSearchMessagesSchema, GmailGetMessageContentSchema, GmailSendMessageSchema } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* List all Gmail labels
|
|
9
|
+
*/
|
|
10
|
+
export declare function gmailListLabels(req: Request, _args: z.infer<typeof GmailListLabelsSchema>): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
labels: {
|
|
13
|
+
id: string | null | undefined;
|
|
14
|
+
name: string | null | undefined;
|
|
15
|
+
type: string;
|
|
16
|
+
}[];
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Search Gmail messages
|
|
20
|
+
*/
|
|
21
|
+
export declare function gmailSearchMessages(req: Request, args: z.infer<typeof GmailSearchMessagesSchema>): Promise<{
|
|
22
|
+
success: boolean;
|
|
23
|
+
messages: {
|
|
24
|
+
id: string;
|
|
25
|
+
subject: string;
|
|
26
|
+
from: string;
|
|
27
|
+
snippet: string;
|
|
28
|
+
}[];
|
|
29
|
+
query: string;
|
|
30
|
+
totalFound: number;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Get detailed content of a specific Gmail message
|
|
34
|
+
*/
|
|
35
|
+
export declare function gmailGetMessageContent(req: Request, args: z.infer<typeof GmailGetMessageContentSchema>): Promise<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
message: {
|
|
38
|
+
id: string | null | undefined;
|
|
39
|
+
threadId: string | null | undefined;
|
|
40
|
+
subject: string;
|
|
41
|
+
from: string;
|
|
42
|
+
to: string;
|
|
43
|
+
date: string;
|
|
44
|
+
body: string;
|
|
45
|
+
};
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Send a Gmail message
|
|
49
|
+
*/
|
|
50
|
+
export declare function gmailSendMessage(req: Request, args: z.infer<typeof GmailSendMessageSchema>): Promise<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
messageId: string | null | undefined;
|
|
53
|
+
details: string;
|
|
54
|
+
}>;
|
|
55
|
+
//# sourceMappingURL=gmail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail.d.ts","sourceRoot":"","sources":["../../src/tools/gmail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQ7B,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,OAAO,EACZ,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC;;;;;;;GAe7C;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC;;;;;;;;;;GA4ChD;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC;;;;;;;;;;;GA4BnD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC;;;;GAsB7C"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gmail tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import { getGmailService } from "../google-api-client.js";
|
|
5
|
+
import { extractEmailBody, getHeader, createEmailMessage, encodeBase64Url, } from "../helpers.js";
|
|
6
|
+
/**
|
|
7
|
+
* List all Gmail labels
|
|
8
|
+
*/
|
|
9
|
+
export async function gmailListLabels(req, _args) {
|
|
10
|
+
const gmail = getGmailService(req);
|
|
11
|
+
const response = await gmail.users.labels.list({ userId: "me" });
|
|
12
|
+
const labels = response.data.labels || [];
|
|
13
|
+
return {
|
|
14
|
+
success: true,
|
|
15
|
+
labels: labels.map((label) => ({
|
|
16
|
+
id: label.id,
|
|
17
|
+
name: label.name,
|
|
18
|
+
type: label.type || "user",
|
|
19
|
+
})),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Search Gmail messages
|
|
24
|
+
*/
|
|
25
|
+
export async function gmailSearchMessages(req, args) {
|
|
26
|
+
const gmail = getGmailService(req);
|
|
27
|
+
const { query = "", maxResults = 10 } = args;
|
|
28
|
+
// List messages matching the query
|
|
29
|
+
const listResponse = await gmail.users.messages.list({
|
|
30
|
+
userId: "me",
|
|
31
|
+
q: query || undefined,
|
|
32
|
+
maxResults,
|
|
33
|
+
});
|
|
34
|
+
const messages = listResponse.data.messages || [];
|
|
35
|
+
const detailedMessages = [];
|
|
36
|
+
// Fetch details for all messages up to maxResults
|
|
37
|
+
const messagesToFetch = messages.slice(0, maxResults);
|
|
38
|
+
for (const msg of messagesToFetch) {
|
|
39
|
+
if (!msg.id)
|
|
40
|
+
continue;
|
|
41
|
+
const detail = await gmail.users.messages.get({
|
|
42
|
+
userId: "me",
|
|
43
|
+
id: msg.id,
|
|
44
|
+
});
|
|
45
|
+
const headers = detail.data.payload?.headers || [];
|
|
46
|
+
const subject = getHeader(headers, "Subject") || "No Subject";
|
|
47
|
+
const from = getHeader(headers, "From") || "Unknown";
|
|
48
|
+
detailedMessages.push({
|
|
49
|
+
id: msg.id,
|
|
50
|
+
subject,
|
|
51
|
+
from,
|
|
52
|
+
snippet: detail.data.snippet || "",
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
messages: detailedMessages,
|
|
58
|
+
query,
|
|
59
|
+
totalFound: messages.length,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get detailed content of a specific Gmail message
|
|
64
|
+
*/
|
|
65
|
+
export async function gmailGetMessageContent(req, args) {
|
|
66
|
+
const gmail = getGmailService(req);
|
|
67
|
+
const { messageId } = args;
|
|
68
|
+
const message = await gmail.users.messages.get({
|
|
69
|
+
userId: "me",
|
|
70
|
+
id: messageId,
|
|
71
|
+
format: "full",
|
|
72
|
+
});
|
|
73
|
+
const headers = message.data.payload?.headers || [];
|
|
74
|
+
const body = message.data.payload
|
|
75
|
+
? extractEmailBody(message.data.payload)
|
|
76
|
+
: "";
|
|
77
|
+
return {
|
|
78
|
+
success: true,
|
|
79
|
+
message: {
|
|
80
|
+
id: message.data.id,
|
|
81
|
+
threadId: message.data.threadId,
|
|
82
|
+
subject: getHeader(headers, "Subject") || "No Subject",
|
|
83
|
+
from: getHeader(headers, "From") || "Unknown",
|
|
84
|
+
to: getHeader(headers, "To") || "Unknown",
|
|
85
|
+
date: getHeader(headers, "Date") || "Unknown",
|
|
86
|
+
body: body || "No content found",
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Send a Gmail message
|
|
92
|
+
*/
|
|
93
|
+
export async function gmailSendMessage(req, args) {
|
|
94
|
+
const gmail = getGmailService(req);
|
|
95
|
+
const { to, subject, body } = args;
|
|
96
|
+
// Create the email message
|
|
97
|
+
const emailMessage = createEmailMessage(to, subject, body);
|
|
98
|
+
const encodedMessage = encodeBase64Url(emailMessage);
|
|
99
|
+
// Send the message
|
|
100
|
+
const sentMessage = await gmail.users.messages.send({
|
|
101
|
+
userId: "me",
|
|
102
|
+
requestBody: {
|
|
103
|
+
raw: encodedMessage,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
success: true,
|
|
108
|
+
messageId: sentMessage.data.id,
|
|
109
|
+
details: `Email sent to ${to} with subject "${subject}"`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=gmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmail.js","sourceRoot":"","sources":["../../src/tools/gmail.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAClB,eAAe,GAChB,MAAM,eAAe,CAAC;AAQvB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,GAAY,EACZ,KAA4C;IAE5C,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAEnC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IAE1C,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC7B,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,MAAM;SAC3B,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,K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;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAY,EACZ,IAA4C;IAE5C,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAEnC,2BAA2B;IAC3B,MAAM,YAAY,GAAG,kBAAkB,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAErD,mBAAmB;IACnB,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QAClD,MAAM,EAAE,IAAI;QACZ,WAAW,EAAE;YACX,GAAG,EAAE,cAAc;SACpB;KACF,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE;QAC9B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,OAAO,GAAG;KACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export all tool handlers
|
|
3
|
+
*/
|
|
4
|
+
export { gmailListLabels, gmailSearchMessages, gmailGetMessageContent, gmailSendMessage, } from "./gmail.js";
|
|
5
|
+
export { driveListFiles, driveGetFileContent, driveCreateFile, } from "./drive.js";
|
|
6
|
+
export { calendarListEvents, calendarListCalendars, calendarCreateEvent, } from "./calendar.js";
|
|
7
|
+
export { docsGetDocument, docsCreateDocument, } from "./docs.js";
|
|
8
|
+
export { sheetsGetSpreadsheet, sheetsReadValues, sheetsCreateSpreadsheet, } from "./sheets.js";
|
|
9
|
+
export { slidesGetPresentation, slidesCreatePresentation, } from "./slides.js";
|
|
10
|
+
export { tasksListTaskLists, tasksListTasks, tasksCreateTask, } from "./tasks.js";
|
|
11
|
+
export { formsCreateForm, formsGetForm, } from "./forms.js";
|
|
12
|
+
export { chatListSpaces, chatSendMessage, } from "./chat.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,eAAe,EACf,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export all tool handlers
|
|
3
|
+
*/
|
|
4
|
+
// Gmail tools
|
|
5
|
+
export { gmailListLabels, gmailSearchMessages, gmailGetMessageContent, gmailSendMessage, } from "./gmail.js";
|
|
6
|
+
// Drive tools
|
|
7
|
+
export { driveListFiles, driveGetFileContent, driveCreateFile, } from "./drive.js";
|
|
8
|
+
// Calendar tools
|
|
9
|
+
export { calendarListEvents, calendarListCalendars, calendarCreateEvent, } from "./calendar.js";
|
|
10
|
+
// Docs tools
|
|
11
|
+
export { docsGetDocument, docsCreateDocument, } from "./docs.js";
|
|
12
|
+
// Sheets tools
|
|
13
|
+
export { sheetsGetSpreadsheet, sheetsReadValues, sheetsCreateSpreadsheet, } from "./sheets.js";
|
|
14
|
+
// Slides tools
|
|
15
|
+
export { slidesGetPresentation, slidesCreatePresentation, } from "./slides.js";
|
|
16
|
+
// Tasks tools
|
|
17
|
+
export { tasksListTaskLists, tasksListTasks, tasksCreateTask, } from "./tasks.js";
|
|
18
|
+
// Forms tools
|
|
19
|
+
export { formsCreateForm, formsGetForm, } from "./forms.js";
|
|
20
|
+
// Chat tools
|
|
21
|
+
export { chatListSpaces, chatSendMessage, } from "./chat.js";
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc;AACd,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,cAAc;AACd,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,iBAAiB;AACjB,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,aAAa;AACb,OAAO,EACL,eAAe,EACf,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAEnB,eAAe;AACf,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,eAAe;AACf,OAAO,EACL,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB,cAAc;AACd,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,cAAc;AACd,OAAO,EACL,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,aAAa;AACb,OAAO,EACL,cAAc,EACd,eAAe,GAChB,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Sheets tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import type { Request } from "express";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
import type { SheetsGetSpreadsheetSchema, SheetsReadValuesSchema, SheetsCreateSpreadsheetSchema } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* Get Google Sheets spreadsheet information
|
|
9
|
+
*/
|
|
10
|
+
export declare function sheetsGetSpreadsheet(req: Request, args: z.infer<typeof SheetsGetSpreadsheetSchema>): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
spreadsheet: {
|
|
13
|
+
spreadsheetId: string | null | undefined;
|
|
14
|
+
title: string | null | undefined;
|
|
15
|
+
sheets: {
|
|
16
|
+
sheetId: number | null | undefined;
|
|
17
|
+
title: string | null | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Read values from Google Sheets
|
|
23
|
+
*/
|
|
24
|
+
export declare function sheetsReadValues(req: Request, args: z.infer<typeof SheetsReadValuesSchema>): Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
values: any[][];
|
|
27
|
+
range: string | null | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new Google Sheets spreadsheet
|
|
31
|
+
*/
|
|
32
|
+
export declare function sheetsCreateSpreadsheet(req: Request, args: z.infer<typeof SheetsCreateSpreadsheetSchema>): Promise<{
|
|
33
|
+
success: boolean;
|
|
34
|
+
spreadsheet: {
|
|
35
|
+
spreadsheetId: string | null | undefined;
|
|
36
|
+
title: string | null | undefined;
|
|
37
|
+
spreadsheetUrl: string | null | undefined;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
//# sourceMappingURL=sheets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheets.d.ts","sourceRoot":"","sources":["../../src/tools/sheets.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC;;;;;;;;;;GAqBjD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC;;;;GAe7C;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC;;;;;;;GAqBpD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Sheets tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import { getSheetsService } from "../google-api-client.js";
|
|
5
|
+
/**
|
|
6
|
+
* Get Google Sheets spreadsheet information
|
|
7
|
+
*/
|
|
8
|
+
export async function sheetsGetSpreadsheet(req, args) {
|
|
9
|
+
const sheets = getSheetsService(req);
|
|
10
|
+
const { spreadsheetId } = args;
|
|
11
|
+
const spreadsheet = await sheets.spreadsheets.get({
|
|
12
|
+
spreadsheetId,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
success: true,
|
|
16
|
+
spreadsheet: {
|
|
17
|
+
spreadsheetId: spreadsheet.data.spreadsheetId,
|
|
18
|
+
title: spreadsheet.data.properties?.title,
|
|
19
|
+
sheets: spreadsheet.data.sheets?.map((sheet) => ({
|
|
20
|
+
sheetId: sheet.properties?.sheetId,
|
|
21
|
+
title: sheet.properties?.title,
|
|
22
|
+
})) || [],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Read values from Google Sheets
|
|
28
|
+
*/
|
|
29
|
+
export async function sheetsReadValues(req, args) {
|
|
30
|
+
const sheets = getSheetsService(req);
|
|
31
|
+
const { spreadsheetId, range } = args;
|
|
32
|
+
const result = await sheets.spreadsheets.values.get({
|
|
33
|
+
spreadsheetId,
|
|
34
|
+
range,
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
success: true,
|
|
38
|
+
values: result.data.values || [],
|
|
39
|
+
range: result.data.range,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a new Google Sheets spreadsheet
|
|
44
|
+
*/
|
|
45
|
+
export async function sheetsCreateSpreadsheet(req, args) {
|
|
46
|
+
const sheets = getSheetsService(req);
|
|
47
|
+
const { title } = args;
|
|
48
|
+
const created = await sheets.spreadsheets.create({
|
|
49
|
+
requestBody: {
|
|
50
|
+
properties: {
|
|
51
|
+
title,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
success: true,
|
|
57
|
+
spreadsheet: {
|
|
58
|
+
spreadsheetId: created.data.spreadsheetId,
|
|
59
|
+
title: created.data.properties?.title,
|
|
60
|
+
spreadsheetUrl: created.data.spreadsheetUrl,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=sheets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheets.js","sourceRoot":"","sources":["../../src/tools/sheets.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAO3D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,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gB,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAEvB,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;QAC/C,WAAW,EAAE;YACX,UAAU,EAAE;gBACV,KAAK;aACN;SACF;KACF,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI;QACb,WAAW,EAAE;YACX,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,aAAa;YACzC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK;YACrC,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc;SAC5C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Slides tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import type { Request } from "express";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
import type { SlidesGetPresentationSchema, SlidesCreatePresentationSchema } from "../schemas.js";
|
|
7
|
+
/**
|
|
8
|
+
* Get Google Slides presentation information
|
|
9
|
+
*/
|
|
10
|
+
export declare function slidesGetPresentation(req: Request, args: z.infer<typeof SlidesGetPresentationSchema>): Promise<{
|
|
11
|
+
success: boolean;
|
|
12
|
+
presentation: {
|
|
13
|
+
presentationId: string | null | undefined;
|
|
14
|
+
title: string | null | undefined;
|
|
15
|
+
slides: {
|
|
16
|
+
objectId: string | null | undefined;
|
|
17
|
+
layoutObjectId: string | null | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new Google Slides presentation
|
|
23
|
+
*/
|
|
24
|
+
export declare function slidesCreatePresentation(req: Request, args: z.infer<typeof SlidesCreatePresentationSchema>): Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
presentation: {
|
|
27
|
+
presentationId: string | null | undefined;
|
|
28
|
+
title: string | null | undefined;
|
|
29
|
+
revisionId: string | null | undefined;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=slides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slides.d.ts","sourceRoot":"","sources":["../../src/tools/slides.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EACV,2BAA2B,EAC3B,8BAA8B,EAC/B,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC;;;;;;;;;;GAqBlD;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC;;;;;;;GAmBrD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Slides tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import { getSlidesService } from "../google-api-client.js";
|
|
5
|
+
/**
|
|
6
|
+
* Get Google Slides presentation information
|
|
7
|
+
*/
|
|
8
|
+
export async function slidesGetPresentation(req, args) {
|
|
9
|
+
const slides = getSlidesService(req);
|
|
10
|
+
const { presentationId } = args;
|
|
11
|
+
const presentation = await slides.presentations.get({
|
|
12
|
+
presentationId,
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
success: true,
|
|
16
|
+
presentation: {
|
|
17
|
+
presentationId: presentation.data.presentationId,
|
|
18
|
+
title: presentation.data.title,
|
|
19
|
+
slides: presentation.data.slides?.map((slide) => ({
|
|
20
|
+
objectId: slide.objectId,
|
|
21
|
+
layoutObjectId: slide.slideProperties?.layoutObjectId,
|
|
22
|
+
})) || [],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a new Google Slides presentation
|
|
28
|
+
*/
|
|
29
|
+
export async function slidesCreatePresentation(req, args) {
|
|
30
|
+
const slides = getSlidesService(req);
|
|
31
|
+
const { title } = args;
|
|
32
|
+
const created = await slides.presentations.create({
|
|
33
|
+
requestBody: {
|
|
34
|
+
title,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
success: true,
|
|
39
|
+
presentation: {
|
|
40
|
+
presentationId: created.data.presentationId,
|
|
41
|
+
title: created.data.title,
|
|
42
|
+
revisionId: created.data.revisionId,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=slides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slides.js","sourceRoot":"","sources":["../../src/tools/slides.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,GAAY,EACZ,IAAiD;IAEjD,MAAM,MAAM,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACrC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAEhC,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC;QAClD,cAAc;KACf,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI;QACb,YAAY,EAAE;YACZ,cAAc,EAAE,YAAY,CAAC,IAAI,CAAC,cAAc;YAChD,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK;YAC9B,MAAM,EACJ,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBACxC,QAAQ,EA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