mcp-google-multi 5.3.0 → 5.4.0-beta.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 +1 -1
- package/dist/accounts.js +3 -8
- package/dist/auth.d.ts +1 -4
- package/dist/auth.js +16 -25
- package/dist/client.d.ts +2 -1
- package/dist/client.js +2 -2
- package/dist/executor.js +1 -5
- package/dist/services.js +2 -4
- package/dist/token-store.js +3 -8
- package/dist/tools/admin.d.ts +0 -6
- package/dist/tools/admin.js +8 -13
- package/dist/tools/calendar.js +12 -12
- package/dist/tools/chat.js +5 -5
- package/dist/tools/contacts.js +10 -10
- package/dist/tools/docs.js +28 -28
- package/dist/tools/drive.js +39 -41
- package/dist/tools/forms.js +8 -8
- package/dist/tools/gmail-mime.d.ts +7 -27
- package/dist/tools/gmail-mime.js +10 -36
- package/dist/tools/gmail.js +22 -22
- package/dist/tools/meet.js +6 -6
- package/dist/tools/searchconsole.js +12 -11
- package/dist/tools/sheets.js +30 -30
- package/dist/tools/slides.js +6 -6
- package/dist/tools/tasks.js +13 -13
- package/package.json +16 -4
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RFC 2047 encoded-word (`=?utf-8?B?...?=`) for non-ASCII header text.
|
|
3
|
-
* Long values are split into multiple <=75-char encoded-words separated
|
|
4
|
-
* by `\r\n ` (CRLF SPACE) per the RFC's folding rule.
|
|
5
|
-
*/
|
|
1
|
+
/** RFC 2047 encoded-word (`=?utf-8?B?...?=`) for non-ASCII header text; long values fold into <=75-char chunks joined by CRLF SPACE per the RFC. */
|
|
6
2
|
export declare function encodeHeaderValue(value: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Encode an address-list header (To/Cc/Bcc/From). RFC 2047 forbids
|
|
9
|
-
* encoded-words inside the addr-spec, so only the display name is encoded.
|
|
10
|
-
*/
|
|
3
|
+
/** Address-list headers (To/Cc/Bcc/From): RFC 2047 forbids encoded-words in the addr-spec, so only display names are encoded. */
|
|
11
4
|
export declare function encodeAddressHeader(value: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* RFC 5322 §2.3: CR and LF MUST only occur together as CRLF in bodies.
|
|
14
|
-
* Normalize bare `\n` or `\r` to CRLF.
|
|
15
|
-
*/
|
|
5
|
+
/** RFC 5322 §2.3 forbids bare CR or LF in bodies; normalize everything to CRLF. */
|
|
16
6
|
export declare function normalizeBodyLineEndings(body: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Best-effort HTML→plain-text for reading HTML-only emails. Regex-based on
|
|
19
|
-
* purpose — no HTML parser dependency, and mail HTML is flat enough for it.
|
|
20
|
-
*/
|
|
7
|
+
/** Best-effort HTML→plain-text for HTML-only emails; regex on purpose (avoids an HTML-parser dep, mail HTML is flat enough). */
|
|
21
8
|
export declare function htmlToText(html: string): string;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* Message-ID header, not the Gmail API id. Falls back to the API id when the
|
|
25
|
-
* header is missing so replies still thread inside Gmail.
|
|
26
|
-
*/
|
|
9
|
+
/** In-Reply-To/References need the parent's real RFC 5322 Message-ID header, not the Gmail API id;
|
|
10
|
+
* falls back to the API id so replies still thread inside Gmail. */
|
|
27
11
|
export declare function buildReplyHeaders(fallbackId: string, parentMessageIdHeader: string, parentReferences: string): {
|
|
28
12
|
inReplyTo: string;
|
|
29
13
|
references: string;
|
|
30
14
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Build a multipart/alternative body so HTML-capable clients render the rich
|
|
33
|
-
* version and plain clients fall back. Returns the header value AND the body.
|
|
34
|
-
* Caller composes the full message: headers (including this Content-Type) + CRLF + body.
|
|
35
|
-
*/
|
|
15
|
+
/** multipart/alternative (plain fallback + HTML); caller composes the message: headers (incl. returned Content-Type) + CRLF + body. */
|
|
36
16
|
export declare function buildMultipartAlternative(plainBody: string, htmlBody: string): {
|
|
37
17
|
contentType: string;
|
|
38
18
|
body: string;
|
package/dist/tools/gmail-mime.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from 'node:crypto';
|
|
2
|
-
/**
|
|
3
|
-
* RFC 2047 encoded-word (`=?utf-8?B?...?=`) for non-ASCII header text.
|
|
4
|
-
* Long values are split into multiple <=75-char encoded-words separated
|
|
5
|
-
* by `\r\n ` (CRLF SPACE) per the RFC's folding rule.
|
|
6
|
-
*/
|
|
2
|
+
/** RFC 2047 encoded-word (`=?utf-8?B?...?=`) for non-ASCII header text; long values fold into <=75-char chunks joined by CRLF SPACE per the RFC. */
|
|
7
3
|
export function encodeHeaderValue(value) {
|
|
8
|
-
//
|
|
9
|
-
// string ASCII?", not "is it printable?".
|
|
4
|
+
// Control chars in the span are intentional: testing "entirely ASCII", not "printable".
|
|
10
5
|
// eslint-disable-next-line no-control-regex
|
|
11
6
|
if (value === '' || /^[\x00-\x7F]*$/.test(value))
|
|
12
7
|
return value;
|
|
@@ -16,9 +11,7 @@ export function encodeHeaderValue(value) {
|
|
|
16
11
|
// base64 emits 4 output chars per 3 input bytes (always padded to a
|
|
17
12
|
// multiple of 4). Round maxInner DOWN to a multiple of 4 first.
|
|
18
13
|
const maxBytesPerChunk = Math.floor(maxInner / 4) * 3;
|
|
19
|
-
//
|
|
20
|
-
// sequence — many MUAs decode encoded-words individually before joining,
|
|
21
|
-
// so a mid-byte split would surface as U+FFFD in those clients.
|
|
14
|
+
// Chunk on codepoint boundaries: many MUAs decode each encoded-word separately, so a mid-UTF-8-sequence split renders U+FFFD.
|
|
22
15
|
const chunks = [];
|
|
23
16
|
let buffered = [];
|
|
24
17
|
for (const char of value) {
|
|
@@ -34,10 +27,7 @@ export function encodeHeaderValue(value) {
|
|
|
34
27
|
}
|
|
35
28
|
return chunks.join('\r\n ');
|
|
36
29
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Encode an address-list header (To/Cc/Bcc/From). RFC 2047 forbids
|
|
39
|
-
* encoded-words inside the addr-spec, so only the display name is encoded.
|
|
40
|
-
*/
|
|
30
|
+
/** Address-list headers (To/Cc/Bcc/From): RFC 2047 forbids encoded-words in the addr-spec, so only display names are encoded. */
|
|
41
31
|
export function encodeAddressHeader(value) {
|
|
42
32
|
if (value === '')
|
|
43
33
|
return '';
|
|
@@ -56,10 +46,7 @@ export function encodeAddressHeader(value) {
|
|
|
56
46
|
return trimmed;
|
|
57
47
|
}).filter(Boolean).join(', ');
|
|
58
48
|
}
|
|
59
|
-
/**
|
|
60
|
-
* RFC 5322 §2.3: CR and LF MUST only occur together as CRLF in bodies.
|
|
61
|
-
* Normalize bare `\n` or `\r` to CRLF.
|
|
62
|
-
*/
|
|
49
|
+
/** RFC 5322 §2.3 forbids bare CR or LF in bodies; normalize everything to CRLF. */
|
|
63
50
|
export function normalizeBodyLineEndings(body) {
|
|
64
51
|
return body.replace(/\r\n|\r|\n/g, '\r\n');
|
|
65
52
|
}
|
|
@@ -95,10 +82,7 @@ function stripTags(input, replacement = '') {
|
|
|
95
82
|
}
|
|
96
83
|
return out;
|
|
97
84
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Best-effort HTML→plain-text for reading HTML-only emails. Regex-based on
|
|
100
|
-
* purpose — no HTML parser dependency, and mail HTML is flat enough for it.
|
|
101
|
-
*/
|
|
85
|
+
/** Best-effort HTML→plain-text for HTML-only emails; regex on purpose (avoids an HTML-parser dep, mail HTML is flat enough). */
|
|
102
86
|
export function htmlToText(html) {
|
|
103
87
|
// Repeat until stable: single-pass removal can leave behind sequences
|
|
104
88
|
// reassembled from the removed span's edges (<scr<script>ipt>).
|
|
@@ -137,11 +121,8 @@ export function htmlToText(html) {
|
|
|
137
121
|
.replace(/\n{3,}/g, '\n\n')
|
|
138
122
|
.trim();
|
|
139
123
|
}
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* Message-ID header, not the Gmail API id. Falls back to the API id when the
|
|
143
|
-
* header is missing so replies still thread inside Gmail.
|
|
144
|
-
*/
|
|
124
|
+
/** In-Reply-To/References need the parent's real RFC 5322 Message-ID header, not the Gmail API id;
|
|
125
|
+
* falls back to the API id so replies still thread inside Gmail. */
|
|
145
126
|
export function buildReplyHeaders(fallbackId, parentMessageIdHeader, parentReferences) {
|
|
146
127
|
const parentId = parentMessageIdHeader.trim();
|
|
147
128
|
if (parentId === '')
|
|
@@ -152,19 +133,12 @@ export function buildReplyHeaders(fallbackId, parentMessageIdHeader, parentRefer
|
|
|
152
133
|
references: refs === '' ? parentId : `${refs} ${parentId}`,
|
|
153
134
|
};
|
|
154
135
|
}
|
|
155
|
-
/**
|
|
156
|
-
* RFC 2046 §5.1.1 boundary token: 1-70 chars from a restricted set, no trailing space.
|
|
157
|
-
* randomBytes hex output is only [0-9a-f], all of which are bcharsnospace.
|
|
158
|
-
*/
|
|
136
|
+
/** RFC 2046 §5.1.1 boundary token: hex output is all bcharsnospace, length well under the 70-char cap. */
|
|
159
137
|
function generateMimeBoundary() {
|
|
160
138
|
// 5-char prefix + 32 hex chars = 37 chars, well under the 70-char limit.
|
|
161
139
|
return `=_gm_${randomBytes(16).toString('hex')}`;
|
|
162
140
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Build a multipart/alternative body so HTML-capable clients render the rich
|
|
165
|
-
* version and plain clients fall back. Returns the header value AND the body.
|
|
166
|
-
* Caller composes the full message: headers (including this Content-Type) + CRLF + body.
|
|
167
|
-
*/
|
|
141
|
+
/** multipart/alternative (plain fallback + HTML); caller composes the message: headers (incl. returned Content-Type) + CRLF + body. */
|
|
168
142
|
export function buildMultipartAlternative(plainBody, htmlBody) {
|
|
169
143
|
const boundary = generateMimeBoundary();
|
|
170
144
|
const parts = [
|
package/dist/tools/gmail.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { coerceArray, coerceBoolean } from './_coerce.js';
|
|
3
|
-
import {
|
|
3
|
+
import { gmail as gmailClient } from '@googleapis/gmail';
|
|
4
4
|
import { ACCOUNTS } from '../accounts.js';
|
|
5
5
|
import { getClient } from '../client.js';
|
|
6
6
|
import { handleGoogleApiError } from './_errors.js';
|
|
@@ -120,7 +120,7 @@ export function registerGmailTools(server) {
|
|
|
120
120
|
}, async ({ account, query, maxResults }) => {
|
|
121
121
|
try {
|
|
122
122
|
const auth = await getClient(account);
|
|
123
|
-
const gmail =
|
|
123
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
124
124
|
const listRes = await gmail.users.messages.list({
|
|
125
125
|
userId: 'me',
|
|
126
126
|
q: query,
|
|
@@ -171,7 +171,7 @@ export function registerGmailTools(server) {
|
|
|
171
171
|
}, async ({ account, messageId, full, rawHtml }) => {
|
|
172
172
|
try {
|
|
173
173
|
const auth = await getClient(account);
|
|
174
|
-
const gmail =
|
|
174
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
175
175
|
const res = await gmail.users.messages.get({
|
|
176
176
|
userId: 'me',
|
|
177
177
|
id: messageId,
|
|
@@ -200,7 +200,7 @@ export function registerGmailTools(server) {
|
|
|
200
200
|
}, async ({ account, threadId, full, rawHtml, mode }) => {
|
|
201
201
|
try {
|
|
202
202
|
const auth = await getClient(account);
|
|
203
|
-
const gmail =
|
|
203
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
204
204
|
if (mode === 'summary') {
|
|
205
205
|
const res = await gmail.users.threads.get({
|
|
206
206
|
userId: 'me',
|
|
@@ -253,7 +253,7 @@ export function registerGmailTools(server) {
|
|
|
253
253
|
}, async ({ account, to, subject, body, htmlBody, cc, replyToMessageId, replyToThreadId }) => {
|
|
254
254
|
try {
|
|
255
255
|
const auth = await getClient(account);
|
|
256
|
-
const gmail =
|
|
256
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
257
257
|
const config = (await import('../accounts.js')).ACCOUNT_CONFIG[account];
|
|
258
258
|
const headers = [
|
|
259
259
|
`From: ${encodeAddressHeader(config.email)}`,
|
|
@@ -312,7 +312,7 @@ export function registerGmailTools(server) {
|
|
|
312
312
|
}, async ({ account, messageId, attachmentId, filename, savePath }) => {
|
|
313
313
|
try {
|
|
314
314
|
const auth = await getClient(account);
|
|
315
|
-
const gmail =
|
|
315
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
316
316
|
const res = await gmail.users.messages.attachments.get({
|
|
317
317
|
userId: 'me',
|
|
318
318
|
messageId,
|
|
@@ -351,7 +351,7 @@ export function registerGmailTools(server) {
|
|
|
351
351
|
}, async ({ account, to, subject, body, htmlBody, cc, replyToMessageId, replyToThreadId }) => {
|
|
352
352
|
try {
|
|
353
353
|
const auth = await getClient(account);
|
|
354
|
-
const gmail =
|
|
354
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
355
355
|
const config = (await import('../accounts.js')).ACCOUNT_CONFIG[account];
|
|
356
356
|
const headers = [
|
|
357
357
|
`From: ${encodeAddressHeader(config.email)}`,
|
|
@@ -411,7 +411,7 @@ export function registerGmailTools(server) {
|
|
|
411
411
|
}, async ({ account, messageId, addLabelIds, removeLabelIds }) => {
|
|
412
412
|
try {
|
|
413
413
|
const auth = await getClient(account);
|
|
414
|
-
const gmail =
|
|
414
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
415
415
|
const res = await gmail.users.messages.modify({
|
|
416
416
|
userId: 'me',
|
|
417
417
|
id: messageId,
|
|
@@ -437,7 +437,7 @@ export function registerGmailTools(server) {
|
|
|
437
437
|
}, async ({ account, messageId }) => {
|
|
438
438
|
try {
|
|
439
439
|
const auth = await getClient(account);
|
|
440
|
-
const gmail =
|
|
440
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
441
441
|
const res = await gmail.users.messages.trash({ userId: 'me', id: messageId });
|
|
442
442
|
return {
|
|
443
443
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -456,7 +456,7 @@ export function registerGmailTools(server) {
|
|
|
456
456
|
}, async ({ account, messageId }) => {
|
|
457
457
|
try {
|
|
458
458
|
const auth = await getClient(account);
|
|
459
|
-
const gmail =
|
|
459
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
460
460
|
await gmail.users.messages.delete({ userId: 'me', id: messageId });
|
|
461
461
|
return {
|
|
462
462
|
content: [{ type: 'text', text: JSON.stringify({ deleted: true, messageId }, null, 2) }],
|
|
@@ -477,7 +477,7 @@ export function registerGmailTools(server) {
|
|
|
477
477
|
}, async ({ account, messageIds, addLabelIds, removeLabelIds }) => {
|
|
478
478
|
try {
|
|
479
479
|
const auth = await getClient(account);
|
|
480
|
-
const gmail =
|
|
480
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
481
481
|
await gmail.users.messages.batchModify({
|
|
482
482
|
userId: 'me',
|
|
483
483
|
requestBody: {
|
|
@@ -503,7 +503,7 @@ export function registerGmailTools(server) {
|
|
|
503
503
|
}, async ({ account, messageIds }) => {
|
|
504
504
|
try {
|
|
505
505
|
const auth = await getClient(account);
|
|
506
|
-
const gmail =
|
|
506
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
507
507
|
await gmail.users.messages.batchDelete({
|
|
508
508
|
userId: 'me',
|
|
509
509
|
requestBody: { ids: messageIds },
|
|
@@ -527,7 +527,7 @@ export function registerGmailTools(server) {
|
|
|
527
527
|
}, async ({ account, maxResults, query }) => {
|
|
528
528
|
try {
|
|
529
529
|
const auth = await getClient(account);
|
|
530
|
-
const gmail =
|
|
530
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
531
531
|
const res = await gmail.users.drafts.list({
|
|
532
532
|
userId: 'me',
|
|
533
533
|
maxResults: maxResults ?? 20,
|
|
@@ -550,7 +550,7 @@ export function registerGmailTools(server) {
|
|
|
550
550
|
}, async ({ account, draftId }) => {
|
|
551
551
|
try {
|
|
552
552
|
const auth = await getClient(account);
|
|
553
|
-
const gmail =
|
|
553
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
554
554
|
const res = await gmail.users.drafts.get({
|
|
555
555
|
userId: 'me',
|
|
556
556
|
id: draftId,
|
|
@@ -573,7 +573,7 @@ export function registerGmailTools(server) {
|
|
|
573
573
|
}, async ({ account, draftId }) => {
|
|
574
574
|
try {
|
|
575
575
|
const auth = await getClient(account);
|
|
576
|
-
const gmail =
|
|
576
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
577
577
|
const res = await gmail.users.drafts.send({
|
|
578
578
|
userId: 'me',
|
|
579
579
|
requestBody: { id: draftId },
|
|
@@ -594,7 +594,7 @@ export function registerGmailTools(server) {
|
|
|
594
594
|
}, async ({ account }) => {
|
|
595
595
|
try {
|
|
596
596
|
const auth = await getClient(account);
|
|
597
|
-
const gmail =
|
|
597
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
598
598
|
const res = await gmail.users.labels.list({ userId: 'me' });
|
|
599
599
|
return {
|
|
600
600
|
content: [{ type: 'text', text: JSON.stringify(res.data.labels ?? [], null, 2) }],
|
|
@@ -617,7 +617,7 @@ export function registerGmailTools(server) {
|
|
|
617
617
|
}, async ({ account, name, messageListVisibility, labelListVisibility }) => {
|
|
618
618
|
try {
|
|
619
619
|
const auth = await getClient(account);
|
|
620
|
-
const gmail =
|
|
620
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
621
621
|
const res = await gmail.users.labels.create({
|
|
622
622
|
userId: 'me',
|
|
623
623
|
requestBody: {
|
|
@@ -643,7 +643,7 @@ export function registerGmailTools(server) {
|
|
|
643
643
|
}, async ({ account, labelId }) => {
|
|
644
644
|
try {
|
|
645
645
|
const auth = await getClient(account);
|
|
646
|
-
const gmail =
|
|
646
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
647
647
|
await gmail.users.labels.delete({ userId: 'me', id: labelId });
|
|
648
648
|
return {
|
|
649
649
|
content: [{ type: 'text', text: JSON.stringify({ deleted: true, labelId }, null, 2) }],
|
|
@@ -661,7 +661,7 @@ export function registerGmailTools(server) {
|
|
|
661
661
|
}, async ({ account }) => {
|
|
662
662
|
try {
|
|
663
663
|
const auth = await getClient(account);
|
|
664
|
-
const gmail =
|
|
664
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
665
665
|
const res = await gmail.users.getProfile({ userId: 'me' });
|
|
666
666
|
return {
|
|
667
667
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -684,7 +684,7 @@ export function registerGmailTools(server) {
|
|
|
684
684
|
}, async ({ account, startHistoryId, maxResults, historyTypes }) => {
|
|
685
685
|
try {
|
|
686
686
|
const auth = await getClient(account);
|
|
687
|
-
const gmail =
|
|
687
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
688
688
|
const res = await gmail.users.history.list({
|
|
689
689
|
userId: 'me',
|
|
690
690
|
startHistoryId,
|
|
@@ -707,7 +707,7 @@ export function registerGmailTools(server) {
|
|
|
707
707
|
}, async ({ account }) => {
|
|
708
708
|
try {
|
|
709
709
|
const auth = await getClient(account);
|
|
710
|
-
const gmail =
|
|
710
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
711
711
|
const res = await gmail.users.settings.getVacation({ userId: 'me' });
|
|
712
712
|
return {
|
|
713
713
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -732,7 +732,7 @@ export function registerGmailTools(server) {
|
|
|
732
732
|
}, async ({ account, enableAutoReply, responseSubject, responseBodyPlainText, startTime, endTime, restrictToContacts, restrictToDomain }) => {
|
|
733
733
|
try {
|
|
734
734
|
const auth = await getClient(account);
|
|
735
|
-
const gmail =
|
|
735
|
+
const gmail = gmailClient({ version: 'v1', auth });
|
|
736
736
|
const res = await gmail.users.settings.updateVacation({
|
|
737
737
|
userId: 'me',
|
|
738
738
|
requestBody: {
|
package/dist/tools/meet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { meet as meetClient } from '@googleapis/meet';
|
|
3
3
|
import { ACCOUNTS } from '../accounts.js';
|
|
4
4
|
import { getClient } from '../client.js';
|
|
5
5
|
import { handleGoogleApiError } from './_errors.js';
|
|
@@ -17,7 +17,7 @@ export function registerMeetTools(server) {
|
|
|
17
17
|
}, async ({ account, pageSize, pageToken, filter }) => {
|
|
18
18
|
try {
|
|
19
19
|
const auth = await getClient(account);
|
|
20
|
-
const meet =
|
|
20
|
+
const meet = meetClient({ version: 'v2', auth });
|
|
21
21
|
const res = await meet.conferenceRecords.list({
|
|
22
22
|
pageSize: pageSize ?? 20,
|
|
23
23
|
pageToken,
|
|
@@ -40,7 +40,7 @@ export function registerMeetTools(server) {
|
|
|
40
40
|
}, async ({ account, name }) => {
|
|
41
41
|
try {
|
|
42
42
|
const auth = await getClient(account);
|
|
43
|
-
const meet =
|
|
43
|
+
const meet = meetClient({ version: 'v2', auth });
|
|
44
44
|
const res = await meet.conferenceRecords.get({ name });
|
|
45
45
|
return {
|
|
46
46
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -62,7 +62,7 @@ export function registerMeetTools(server) {
|
|
|
62
62
|
}, async ({ account, parent, pageSize, pageToken }) => {
|
|
63
63
|
try {
|
|
64
64
|
const auth = await getClient(account);
|
|
65
|
-
const meet =
|
|
65
|
+
const meet = meetClient({ version: 'v2', auth });
|
|
66
66
|
const res = await meet.conferenceRecords.recordings.list({
|
|
67
67
|
parent,
|
|
68
68
|
pageSize: pageSize ?? 20,
|
|
@@ -88,7 +88,7 @@ export function registerMeetTools(server) {
|
|
|
88
88
|
}, async ({ account, parent, pageSize, pageToken }) => {
|
|
89
89
|
try {
|
|
90
90
|
const auth = await getClient(account);
|
|
91
|
-
const meet =
|
|
91
|
+
const meet = meetClient({ version: 'v2', auth });
|
|
92
92
|
const res = await meet.conferenceRecords.transcripts.list({
|
|
93
93
|
parent,
|
|
94
94
|
pageSize: pageSize ?? 20,
|
|
@@ -113,7 +113,7 @@ export function registerMeetTools(server) {
|
|
|
113
113
|
}, async ({ account, parent, pageSize, pageToken }) => {
|
|
114
114
|
try {
|
|
115
115
|
const auth = await getClient(account);
|
|
116
|
-
const meet =
|
|
116
|
+
const meet = meetClient({ version: 'v2', auth });
|
|
117
117
|
const res = await meet.conferenceRecords.transcripts.entries.list({
|
|
118
118
|
parent,
|
|
119
119
|
pageSize: pageSize ?? 200,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { coerceArray, coerceJson } from './_coerce.js';
|
|
3
|
-
import {
|
|
3
|
+
import { searchconsole as searchconsoleClient } from '@googleapis/searchconsole';
|
|
4
|
+
import { webmasters as webmastersClient } from '@googleapis/webmasters';
|
|
4
5
|
import { ACCOUNTS } from '../accounts.js';
|
|
5
6
|
import { getClient } from '../client.js';
|
|
6
7
|
import { handleGoogleApiError } from './_errors.js';
|
|
@@ -15,7 +16,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
15
16
|
}, async ({ account }) => {
|
|
16
17
|
try {
|
|
17
18
|
const auth = await getClient(account);
|
|
18
|
-
const wm =
|
|
19
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
19
20
|
const res = await wm.sites.list();
|
|
20
21
|
return {
|
|
21
22
|
content: [{ type: 'text', text: JSON.stringify(res.data.siteEntry ?? [], null, 2) }],
|
|
@@ -34,7 +35,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
34
35
|
}, async ({ account, siteUrl }) => {
|
|
35
36
|
try {
|
|
36
37
|
const auth = await getClient(account);
|
|
37
|
-
const wm =
|
|
38
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
38
39
|
const res = await wm.sites.get({ siteUrl });
|
|
39
40
|
return {
|
|
40
41
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -53,7 +54,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
53
54
|
}, async ({ account, siteUrl }) => {
|
|
54
55
|
try {
|
|
55
56
|
const auth = await getClient(account);
|
|
56
|
-
const wm =
|
|
57
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
57
58
|
await wm.sites.add({ siteUrl });
|
|
58
59
|
return {
|
|
59
60
|
content: [{ type: 'text', text: JSON.stringify({ success: true, siteUrl }, null, 2) }],
|
|
@@ -72,7 +73,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
72
73
|
}, async ({ account, siteUrl }) => {
|
|
73
74
|
try {
|
|
74
75
|
const auth = await getClient(account);
|
|
75
|
-
const wm =
|
|
76
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
76
77
|
await wm.sites.delete({ siteUrl });
|
|
77
78
|
return {
|
|
78
79
|
content: [{ type: 'text', text: JSON.stringify({ success: true, deleted: siteUrl }, null, 2) }],
|
|
@@ -92,7 +93,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
92
93
|
}, async ({ account, siteUrl }) => {
|
|
93
94
|
try {
|
|
94
95
|
const auth = await getClient(account);
|
|
95
|
-
const wm =
|
|
96
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
96
97
|
const res = await wm.sitemaps.list({ siteUrl });
|
|
97
98
|
return {
|
|
98
99
|
content: [{ type: 'text', text: JSON.stringify(res.data.sitemap ?? [], null, 2) }],
|
|
@@ -112,7 +113,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
112
113
|
}, async ({ account, siteUrl, feedpath }) => {
|
|
113
114
|
try {
|
|
114
115
|
const auth = await getClient(account);
|
|
115
|
-
const wm =
|
|
116
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
116
117
|
const res = await wm.sitemaps.get({ siteUrl, feedpath });
|
|
117
118
|
return {
|
|
118
119
|
content: [{ type: 'text', text: JSON.stringify(res.data, null, 2) }],
|
|
@@ -132,7 +133,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
132
133
|
}, async ({ account, siteUrl, feedpath }) => {
|
|
133
134
|
try {
|
|
134
135
|
const auth = await getClient(account);
|
|
135
|
-
const wm =
|
|
136
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
136
137
|
await wm.sitemaps.submit({ siteUrl, feedpath });
|
|
137
138
|
return {
|
|
138
139
|
content: [{ type: 'text', text: JSON.stringify({ success: true, siteUrl, feedpath }, null, 2) }],
|
|
@@ -152,7 +153,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
152
153
|
}, async ({ account, siteUrl, feedpath }) => {
|
|
153
154
|
try {
|
|
154
155
|
const auth = await getClient(account);
|
|
155
|
-
const wm =
|
|
156
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
156
157
|
await wm.sitemaps.delete({ siteUrl, feedpath });
|
|
157
158
|
return {
|
|
158
159
|
content: [{ type: 'text', text: JSON.stringify({ success: true, deleted: feedpath }, null, 2) }],
|
|
@@ -195,7 +196,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
195
196
|
}, async ({ account, siteUrl, startDate, endDate, dimensions, type, dimensionFilterGroups, rowLimit, startRow, aggregationType, dataState }) => {
|
|
196
197
|
try {
|
|
197
198
|
const auth = await getClient(account);
|
|
198
|
-
const wm =
|
|
199
|
+
const wm = webmastersClient({ version: 'v3', auth });
|
|
199
200
|
const requestBody = { startDate, endDate };
|
|
200
201
|
if (dimensions)
|
|
201
202
|
requestBody.dimensions = dimensions;
|
|
@@ -237,7 +238,7 @@ export function registerSearchConsoleTools(server) {
|
|
|
237
238
|
}, async ({ account, siteUrl, inspectionUrl, languageCode }) => {
|
|
238
239
|
try {
|
|
239
240
|
const auth = await getClient(account);
|
|
240
|
-
const searchconsole =
|
|
241
|
+
const searchconsole = searchconsoleClient({ version: 'v1', auth });
|
|
241
242
|
const res = await searchconsole.urlInspection.index.inspect({
|
|
242
243
|
requestBody: {
|
|
243
244
|
inspectionUrl,
|