@mindstone/mcp-server-google-workspace 0.2.0 → 0.4.0
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 +15 -12
- package/dist/modules/chat/index.d.ts +12 -0
- package/dist/modules/chat/index.js +18 -0
- package/dist/modules/chat/scopes.d.ts +14 -0
- package/dist/modules/chat/scopes.js +32 -0
- package/dist/modules/chat/types.d.ts +88 -0
- package/dist/modules/chat/types.js +14 -0
- package/dist/modules/comments/service.js +21 -1
- package/dist/modules/contacts/scopes.d.ts +1 -0
- package/dist/modules/contacts/scopes.js +2 -2
- package/dist/modules/contacts/types.d.ts +34 -0
- package/dist/modules/docs/service.js +29 -1
- package/dist/modules/drive/activity-service.d.ts +45 -0
- package/dist/modules/drive/activity-service.js +114 -0
- package/dist/modules/drive/index.d.ts +4 -0
- package/dist/modules/drive/index.js +12 -0
- package/dist/modules/drive/scopes.d.ts +1 -0
- package/dist/modules/drive/scopes.js +3 -0
- package/dist/modules/forms/service.js +13 -1
- package/dist/modules/gmail/services/base.d.ts +5 -1
- package/dist/modules/gmail/services/base.js +8 -0
- package/dist/modules/gmail/services/settings.d.ts +14 -1
- package/dist/modules/gmail/services/settings.js +94 -0
- package/dist/modules/gmail/types.d.ts +36 -0
- package/dist/modules/meet/index.d.ts +12 -0
- package/dist/modules/meet/index.js +18 -0
- package/dist/modules/meet/scopes.d.ts +9 -0
- package/dist/modules/meet/scopes.js +25 -0
- package/dist/modules/meet/types.d.ts +97 -0
- package/dist/modules/meet/types.js +14 -0
- package/dist/modules/sheets/service.js +49 -0
- package/dist/modules/slides/service.js +25 -1
- package/dist/modules/tasks/service.js +25 -1
- package/dist/services/base/BaseGoogleService.d.ts +9 -1
- package/dist/services/base/BaseGoogleService.js +26 -1
- package/dist/services/chat/index.d.ts +34 -0
- package/dist/services/chat/index.js +120 -0
- package/dist/services/contacts/index.d.ts +19 -1
- package/dist/services/contacts/index.js +124 -0
- package/dist/services/meet/index.d.ts +35 -0
- package/dist/services/meet/index.js +116 -0
- package/dist/tools/chat-handlers.d.ts +14 -0
- package/dist/tools/chat-handlers.js +126 -0
- package/dist/tools/contacts-handlers.d.ts +31 -0
- package/dist/tools/contacts-handlers.js +88 -0
- package/dist/tools/definitions/chat.d.ts +3 -0
- package/dist/tools/definitions/chat.js +137 -0
- package/dist/tools/definitions/contacts.js +82 -0
- package/dist/tools/definitions/destructive-overrides.json +11 -0
- package/dist/tools/definitions/drive.js +48 -0
- package/dist/tools/definitions/gmail.js +94 -0
- package/dist/tools/definitions/index.d.ts +4 -2
- package/dist/tools/definitions/index.js +10 -6
- package/dist/tools/definitions/meet.d.ts +3 -0
- package/dist/tools/definitions/meet.js +149 -0
- package/dist/tools/definitions/open-world-overrides.json +11 -0
- package/dist/tools/drive-handlers.d.ts +17 -0
- package/dist/tools/drive-handlers.js +49 -1
- package/dist/tools/gmail-handlers.d.ts +24 -0
- package/dist/tools/gmail-handlers.js +129 -11
- package/dist/tools/meet-handlers.d.ts +42 -0
- package/dist/tools/meet-handlers.js +144 -0
- package/dist/tools/server.js +53 -3
- package/dist/utils/apiError.js +5 -2
- package/dist/utils/scope-hierarchy.js +10 -0
- package/dist/utils/service-initializer.d.ts +0 -10
- package/dist/utils/service-initializer.js +14 -23
- package/dist/utils/untrusted-content.d.ts +37 -1
- package/dist/utils/untrusted-content.js +61 -6
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
|
4
4
|
import { toMcpError } from '../utils/apiError.js';
|
|
5
5
|
import { AttachmentService } from '../modules/attachments/service.js';
|
|
6
6
|
import { ATTACHMENT_FOLDERS } from '../modules/attachments/types.js';
|
|
7
|
-
import { lstatSync, readFileSync, realpathSync, statSync } from 'fs';
|
|
7
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readFileSync, realpathSync, statSync } from 'fs';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import { wrapUntrustedContent, wrapUntrustedJsonStrings } from '../utils/untrusted-content.js';
|
|
10
10
|
// Singleton instances
|
|
@@ -104,15 +104,45 @@ export function resolveAttachmentFromPath(filePath) {
|
|
|
104
104
|
if (!isPathInsideDirectory(candidateRealpath, rootRealpath)) {
|
|
105
105
|
throw new McpError(ErrorCode.InvalidParams, `Attachment path must be within the workspace directory. Got: ${filePath}`);
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
// Pin the identity (device + inode) of the object that passed containment.
|
|
108
|
+
// O_NOFOLLOW only refuses a symlink in the FINAL path component — an
|
|
109
|
+
// attacker who swaps an intermediate directory for an out-of-workspace
|
|
110
|
+
// symlink between this check and the open would otherwise redirect the read.
|
|
111
|
+
// Re-verifying the opened descriptor's identity against the validated one
|
|
112
|
+
// fails closed on any such swap (ancestor-directory or final-component).
|
|
113
|
+
const validatedStats = statSync(candidateRealpath);
|
|
114
|
+
if (!validatedStats.isFile()) {
|
|
115
|
+
throw new McpError(ErrorCode.InvalidParams, 'Attachment path must point to a regular file.');
|
|
116
|
+
}
|
|
117
|
+
// Open once and read through the fd: checking the path and then re-opening it
|
|
118
|
+
// by name would leave a swap race between the containment check and the read.
|
|
119
|
+
// O_NOFOLLOW (where the platform supports it) refuses a symlink planted in
|
|
120
|
+
// that window.
|
|
121
|
+
const fd = openSync(candidateRealpath, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
122
|
+
try {
|
|
123
|
+
const stats = fstatSync(fd);
|
|
124
|
+
if (!stats.isFile()) {
|
|
125
|
+
throw new McpError(ErrorCode.InvalidParams, 'Attachment path must point to a regular file.');
|
|
126
|
+
}
|
|
127
|
+
if (stats.dev !== validatedStats.dev || stats.ino !== validatedStats.ino) {
|
|
128
|
+
throw new McpError(ErrorCode.InvalidParams, 'Attachment file changed while it was being verified; refusing to read it.');
|
|
129
|
+
}
|
|
130
|
+
// Irreducible residual: an attacker who can already write the validated
|
|
131
|
+
// in-workspace file can mutate its content in place (same inode) between
|
|
132
|
+
// this check and the read. That is not a containment escape — the bytes
|
|
133
|
+
// still come from the approved workspace file — so it is out of scope here.
|
|
134
|
+
const content = readFileSync(fd);
|
|
135
|
+
const ext = path.extname(candidateRealpath).toLowerCase();
|
|
136
|
+
return {
|
|
137
|
+
content: content.toString('base64'),
|
|
138
|
+
name: path.basename(candidateRealpath),
|
|
139
|
+
mimeType: MIME_TYPES[ext] || 'application/octet-stream',
|
|
140
|
+
size: stats.size,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
finally {
|
|
144
|
+
closeSync(fd);
|
|
145
|
+
}
|
|
116
146
|
}
|
|
117
147
|
function processOutgoingAttachments(attachments) {
|
|
118
148
|
return attachments?.map(attachment => {
|
|
@@ -152,7 +182,15 @@ function readAliasedNumber(args, canonicalKey, legacyKey) {
|
|
|
152
182
|
}
|
|
153
183
|
function readAliasedBoolean(args, canonicalKey, legacyKey) {
|
|
154
184
|
const value = args[canonicalKey] ?? args[legacyKey];
|
|
155
|
-
|
|
185
|
+
if (value === undefined || value === null)
|
|
186
|
+
return undefined;
|
|
187
|
+
// Fail closed on wrong-typed input (e.g. the string "true") rather than
|
|
188
|
+
// silently treating it as absent — for write flags like clear_end_time a
|
|
189
|
+
// coerced default can mask what the caller asked for.
|
|
190
|
+
if (typeof value !== 'boolean') {
|
|
191
|
+
throw new McpError(ErrorCode.InvalidParams, `"${canonicalKey}" must be a boolean (true/false), got ${typeof value}`);
|
|
192
|
+
}
|
|
193
|
+
return value;
|
|
156
194
|
}
|
|
157
195
|
function readAliasedStringArray(args, canonicalKey, legacyKey) {
|
|
158
196
|
const value = args[canonicalKey] ?? args[legacyKey];
|
|
@@ -543,6 +581,86 @@ export async function handleGetWorkspaceGmailSettings(params) {
|
|
|
543
581
|
}
|
|
544
582
|
});
|
|
545
583
|
}
|
|
584
|
+
/**
|
|
585
|
+
* Parses a vacation start/end timestamp per the repo's epoch-ms rules: a number
|
|
586
|
+
* or digit-only string in the unambiguous epoch-ms window [1e12, 1e14), or a
|
|
587
|
+
* parseable date string. Anything else — notably Unix *seconds* like
|
|
588
|
+
* 1735689600, which would silently be 1000x off — is rejected.
|
|
589
|
+
*/
|
|
590
|
+
function parseEpochMsField(value, fieldName) {
|
|
591
|
+
if (value === undefined || value === null)
|
|
592
|
+
return undefined;
|
|
593
|
+
if (typeof value === 'number') {
|
|
594
|
+
if (!Number.isFinite(value) || value < 1e12 || value >= 1e14) {
|
|
595
|
+
throw new McpError(ErrorCode.InvalidParams, `${fieldName} numbers must be epoch milliseconds (e.g. 1735689600000), not seconds`);
|
|
596
|
+
}
|
|
597
|
+
return value;
|
|
598
|
+
}
|
|
599
|
+
if (typeof value === 'string') {
|
|
600
|
+
if (/^\d+$/.test(value)) {
|
|
601
|
+
const parsed = Number(value);
|
|
602
|
+
if (parsed >= 1e12 && parsed < 1e14)
|
|
603
|
+
return parsed;
|
|
604
|
+
throw new McpError(ErrorCode.InvalidParams, `${fieldName} digit-only strings must be epoch milliseconds (e.g. 1735689600000), not seconds`);
|
|
605
|
+
}
|
|
606
|
+
const parsed = Date.parse(value);
|
|
607
|
+
if (Number.isNaN(parsed)) {
|
|
608
|
+
throw new McpError(ErrorCode.InvalidParams, `${fieldName} must be epoch milliseconds or a parseable date string (e.g. "2026-08-07")`);
|
|
609
|
+
}
|
|
610
|
+
return parsed;
|
|
611
|
+
}
|
|
612
|
+
throw new McpError(ErrorCode.InvalidParams, `${fieldName} must be a number or a date string`);
|
|
613
|
+
}
|
|
614
|
+
export async function handleUpdateWorkspaceVacationResponder(params) {
|
|
615
|
+
await initializeServices();
|
|
616
|
+
const rawParams = params;
|
|
617
|
+
const email = await resolveEmail(params);
|
|
618
|
+
const enabled = readAliasedBoolean(rawParams, 'enabled', 'enabled');
|
|
619
|
+
if (enabled === undefined) {
|
|
620
|
+
throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: "enabled" (true to turn the out-of-office reply on, false to turn it off)');
|
|
621
|
+
}
|
|
622
|
+
const startTime = parseEpochMsField(rawParams.start_time ?? rawParams.startTime, 'start_time');
|
|
623
|
+
const endTime = parseEpochMsField(rawParams.end_time ?? rawParams.endTime, 'end_time');
|
|
624
|
+
const clearEndTime = readAliasedBoolean(rawParams, 'clear_end_time', 'clearEndTime') ?? false;
|
|
625
|
+
if (clearEndTime && endTime !== undefined) {
|
|
626
|
+
throw new McpError(ErrorCode.InvalidParams, 'Pass either end_time or clear_end_time, not both');
|
|
627
|
+
}
|
|
628
|
+
if (startTime !== undefined && endTime !== undefined && endTime <= startTime) {
|
|
629
|
+
throw new McpError(ErrorCode.InvalidParams, 'end_time must be after start_time');
|
|
630
|
+
}
|
|
631
|
+
return accountManager.withTokenRenewal(email, async () => {
|
|
632
|
+
try {
|
|
633
|
+
const result = await gmailService.updateVacationResponder({
|
|
634
|
+
email,
|
|
635
|
+
enabled,
|
|
636
|
+
responseSubject: readAliasedString(rawParams, 'response_subject', 'responseSubject'),
|
|
637
|
+
responseBody: readAliasedString(rawParams, 'response_body', 'responseBody'),
|
|
638
|
+
startTime,
|
|
639
|
+
endTime,
|
|
640
|
+
clearEndTime,
|
|
641
|
+
contactsOnly: readAliasedBoolean(rawParams, 'contacts_only', 'contactsOnly'),
|
|
642
|
+
domainOnly: readAliasedBoolean(rawParams, 'domain_only', 'domainOnly')
|
|
643
|
+
});
|
|
644
|
+
return wrapUntrustedJsonStrings(result, 'google-workspace:gmail:vacation-responder');
|
|
645
|
+
}
|
|
646
|
+
catch (error) {
|
|
647
|
+
throw toMcpError(error, 'Failed to update vacation responder');
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
export async function handleListWorkspaceSendAs(params) {
|
|
652
|
+
await initializeServices();
|
|
653
|
+
const email = await resolveEmail(params);
|
|
654
|
+
return accountManager.withTokenRenewal(email, async () => {
|
|
655
|
+
try {
|
|
656
|
+
const result = await gmailService.listSendAs({ email });
|
|
657
|
+
return wrapUntrustedJsonStrings(result, 'google-workspace:gmail:send-as');
|
|
658
|
+
}
|
|
659
|
+
catch (error) {
|
|
660
|
+
throw toMcpError(error, 'Failed to list send-as aliases');
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
}
|
|
546
664
|
export async function handleManageWorkspaceDraft(params) {
|
|
547
665
|
await initializeServices();
|
|
548
666
|
const rawParams = params;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ListConferenceRecordsResponse, ListTranscriptsResponse, ListTranscriptEntriesResponse } from "../modules/meet/types.js";
|
|
2
|
+
interface ListMeetConferenceRecordsHandlerParams {
|
|
3
|
+
email?: string;
|
|
4
|
+
page_size?: number;
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
page_token?: string;
|
|
7
|
+
pageToken?: string;
|
|
8
|
+
filter?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Handler function for listing Google Meet conference records.
|
|
12
|
+
*/
|
|
13
|
+
export declare function handleListMeetConferenceRecords(params: ListMeetConferenceRecordsHandlerParams & Record<string, unknown>): Promise<ListConferenceRecordsResponse>;
|
|
14
|
+
interface ListMeetTranscriptsHandlerParams {
|
|
15
|
+
email?: string;
|
|
16
|
+
conference_record?: string;
|
|
17
|
+
conferenceRecord?: string;
|
|
18
|
+
page_size?: number;
|
|
19
|
+
pageSize?: number;
|
|
20
|
+
page_token?: string;
|
|
21
|
+
pageToken?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Handler function for listing the transcripts of a Google Meet conference record.
|
|
25
|
+
*/
|
|
26
|
+
export declare function handleListMeetTranscripts(params: ListMeetTranscriptsHandlerParams & Record<string, unknown>): Promise<ListTranscriptsResponse>;
|
|
27
|
+
interface GetMeetTranscriptEntriesHandlerParams {
|
|
28
|
+
email?: string;
|
|
29
|
+
conference_record?: string;
|
|
30
|
+
conferenceRecord?: string;
|
|
31
|
+
transcript?: string;
|
|
32
|
+
page_size?: number;
|
|
33
|
+
pageSize?: number;
|
|
34
|
+
page_token?: string;
|
|
35
|
+
pageToken?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Handler function for listing the entries (speaker + text) of one Google Meet transcript.
|
|
39
|
+
*/
|
|
40
|
+
export declare function handleGetMeetTranscriptEntries(params: GetMeetTranscriptEntriesHandlerParams & Record<string, unknown>): Promise<ListTranscriptEntriesResponse>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=meet-handlers.d.ts.map
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { MeetService } from "../services/meet/index.js";
|
|
2
|
+
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { toMcpError } from "../utils/apiError.js";
|
|
4
|
+
import { getAccountManager, resolveEmail } from "../modules/accounts/index.js";
|
|
5
|
+
import { readAliasedNumber, readAliasedString } from './arg-aliases.js';
|
|
6
|
+
import { wrapUntrustedJsonStrings } from "../utils/untrusted-content.js";
|
|
7
|
+
// Singleton instances - Initialize or inject as per project pattern
|
|
8
|
+
let meetService;
|
|
9
|
+
let accountManager;
|
|
10
|
+
// The Meet API coerces page sizes above 100 to 100; cap client-side so the
|
|
11
|
+
// request we send matches what the tool contract documents.
|
|
12
|
+
const MEET_MAX_PAGE_SIZE = 100;
|
|
13
|
+
/**
|
|
14
|
+
* Initialize required services.
|
|
15
|
+
* This should likely be integrated into a central initialization process.
|
|
16
|
+
*/
|
|
17
|
+
async function initializeServices() {
|
|
18
|
+
if (!meetService) {
|
|
19
|
+
meetService = new MeetService();
|
|
20
|
+
}
|
|
21
|
+
if (!accountManager) {
|
|
22
|
+
accountManager = getAccountManager();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Normalizes a user-supplied conference record reference into the
|
|
27
|
+
* 'conferenceRecords/{id}' parent format the Meet API expects. Accepts either
|
|
28
|
+
* the bare ID or the full resource name.
|
|
29
|
+
*/
|
|
30
|
+
function toConferenceRecordName(conferenceRecord) {
|
|
31
|
+
const trimmed = conferenceRecord.trim();
|
|
32
|
+
return trimmed.startsWith('conferenceRecords/')
|
|
33
|
+
? trimmed
|
|
34
|
+
: `conferenceRecords/${trimmed}`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Normalizes a conference record + transcript pair into the
|
|
38
|
+
* 'conferenceRecords/{id}/transcripts/{tid}' parent format the Meet API
|
|
39
|
+
* expects. The transcript may be given as a bare ID, a 'transcripts/{id}'
|
|
40
|
+
* segment, or a full resource name (in which case it is used as-is).
|
|
41
|
+
*/
|
|
42
|
+
function toTranscriptName(conferenceRecord, transcript) {
|
|
43
|
+
const trimmedTranscript = transcript.trim();
|
|
44
|
+
if (trimmedTranscript.startsWith('conferenceRecords/')) {
|
|
45
|
+
return trimmedTranscript;
|
|
46
|
+
}
|
|
47
|
+
const conferenceRecordName = toConferenceRecordName(conferenceRecord);
|
|
48
|
+
return trimmedTranscript.startsWith('transcripts/')
|
|
49
|
+
? `${conferenceRecordName}/${trimmedTranscript}`
|
|
50
|
+
: `${conferenceRecordName}/transcripts/${trimmedTranscript}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Handler function for listing Google Meet conference records.
|
|
54
|
+
*/
|
|
55
|
+
export async function handleListMeetConferenceRecords(params) {
|
|
56
|
+
await initializeServices(); // Ensure services are ready
|
|
57
|
+
const pageSize = readAliasedNumber(params, 'page_size', 'pageSize');
|
|
58
|
+
const pageToken = readAliasedString(params, 'page_token', 'pageToken');
|
|
59
|
+
const filter = readAliasedString(params, 'filter', 'filter');
|
|
60
|
+
// Resolve email - uses instance account if not provided, validates if provided
|
|
61
|
+
const email = await resolveEmail(params);
|
|
62
|
+
// Use accountManager for token renewal like in Contacts handlers
|
|
63
|
+
return accountManager.withTokenRenewal(email, async () => {
|
|
64
|
+
try {
|
|
65
|
+
const result = await meetService.listConferenceRecords({
|
|
66
|
+
email,
|
|
67
|
+
pageSize: pageSize !== undefined ? Math.min(pageSize, MEET_MAX_PAGE_SIZE) : undefined,
|
|
68
|
+
pageToken,
|
|
69
|
+
filter
|
|
70
|
+
});
|
|
71
|
+
return wrapUntrustedJsonStrings(result, 'google-workspace:meet:conference-records');
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
// toMcpError passes an McpError (and auth-handoff errors) through, and folds a
|
|
75
|
+
// MeetError's details into the message (InternalError) so the real cause reaches
|
|
76
|
+
// the user — the host drops an McpError's `data` arg, so details-as-data would
|
|
77
|
+
// be invisible.
|
|
78
|
+
throw toMcpError(error, 'Failed to list conference records');
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Handler function for listing the transcripts of a Google Meet conference record.
|
|
84
|
+
*/
|
|
85
|
+
export async function handleListMeetTranscripts(params) {
|
|
86
|
+
await initializeServices();
|
|
87
|
+
const conferenceRecord = readAliasedString(params, 'conference_record', 'conferenceRecord');
|
|
88
|
+
const pageSize = readAliasedNumber(params, 'page_size', 'pageSize');
|
|
89
|
+
const pageToken = readAliasedString(params, 'page_token', 'pageToken');
|
|
90
|
+
// Resolve email - uses instance account if not provided, validates if provided
|
|
91
|
+
const email = await resolveEmail(params);
|
|
92
|
+
if (!conferenceRecord) {
|
|
93
|
+
throw new McpError(ErrorCode.InvalidParams, 'conference_record parameter is required (e.g. "conferenceRecords/abc-123" or just "abc-123")');
|
|
94
|
+
}
|
|
95
|
+
return accountManager.withTokenRenewal(email, async () => {
|
|
96
|
+
try {
|
|
97
|
+
const result = await meetService.listTranscripts({
|
|
98
|
+
email,
|
|
99
|
+
parent: toConferenceRecordName(conferenceRecord),
|
|
100
|
+
pageSize: pageSize !== undefined ? Math.min(pageSize, MEET_MAX_PAGE_SIZE) : undefined,
|
|
101
|
+
pageToken
|
|
102
|
+
});
|
|
103
|
+
return wrapUntrustedJsonStrings(result, 'google-workspace:meet:transcripts');
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
// See handleListMeetConferenceRecords: toMcpError surfaces the real cause.
|
|
107
|
+
throw toMcpError(error, 'Failed to list transcripts');
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Handler function for listing the entries (speaker + text) of one Google Meet transcript.
|
|
113
|
+
*/
|
|
114
|
+
export async function handleGetMeetTranscriptEntries(params) {
|
|
115
|
+
await initializeServices();
|
|
116
|
+
const conferenceRecord = readAliasedString(params, 'conference_record', 'conferenceRecord');
|
|
117
|
+
const transcript = readAliasedString(params, 'transcript', 'transcript');
|
|
118
|
+
const pageSize = readAliasedNumber(params, 'page_size', 'pageSize');
|
|
119
|
+
const pageToken = readAliasedString(params, 'page_token', 'pageToken');
|
|
120
|
+
// Resolve email - uses instance account if not provided, validates if provided
|
|
121
|
+
const email = await resolveEmail(params);
|
|
122
|
+
if (!conferenceRecord) {
|
|
123
|
+
throw new McpError(ErrorCode.InvalidParams, 'conference_record parameter is required (e.g. "conferenceRecords/abc-123" or just "abc-123")');
|
|
124
|
+
}
|
|
125
|
+
if (!transcript) {
|
|
126
|
+
throw new McpError(ErrorCode.InvalidParams, 'transcript parameter is required (e.g. "def-456", "transcripts/def-456", or a full resource name)');
|
|
127
|
+
}
|
|
128
|
+
return accountManager.withTokenRenewal(email, async () => {
|
|
129
|
+
try {
|
|
130
|
+
const result = await meetService.listTranscriptEntries({
|
|
131
|
+
email,
|
|
132
|
+
parent: toTranscriptName(conferenceRecord, transcript),
|
|
133
|
+
pageSize: pageSize !== undefined ? Math.min(pageSize, MEET_MAX_PAGE_SIZE) : undefined,
|
|
134
|
+
pageToken
|
|
135
|
+
});
|
|
136
|
+
return wrapUntrustedJsonStrings(result, 'google-workspace:meet:transcript-entries');
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
// See handleListMeetConferenceRecords: toMcpError surfaces the real cause.
|
|
140
|
+
throw toMcpError(error, 'Failed to get transcript entries');
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=meet-handlers.js.map
|
package/dist/tools/server.js
CHANGED
|
@@ -12,11 +12,11 @@ import { allTools } from './definitions.js';
|
|
|
12
12
|
import { ToolRegistry } from '../modules/tools/registry.js';
|
|
13
13
|
// Import handlers
|
|
14
14
|
import { handleListWorkspaceAccounts, handleAuthenticateWorkspaceAccount, handleRemoveWorkspaceAccount } from './account-handlers.js';
|
|
15
|
-
import { handleSearchWorkspaceEmails, handleGetWorkspaceEmailThread, handleComposeWorkspaceEmail, handleSendWorkspaceEmail, handleGetWorkspaceGmailSettings, handleManageWorkspaceDraft, handleManageWorkspaceLabel, handleManageWorkspaceLabelAssignment, handleManageWorkspaceLabelFilter, handleManageWorkspaceAttachment, handleListWorkspaceDrafts, handleGetWorkspaceDraft, handleCreateWorkspaceDraft, handleUpdateWorkspaceDraft, handleDeleteWorkspaceDraft, handleSendWorkspaceDraft, handleDownloadWorkspaceAttachment, handleUploadWorkspaceAttachment, handleDeleteWorkspaceAttachment, handleListWorkspaceLabels, handleGetWorkspaceLabel, handleCreateWorkspaceLabel, handleUpdateWorkspaceLabel, handleDeleteWorkspaceLabel, handleListWorkspaceLabelFilters, handleCreateWorkspaceLabelFilter, handleUpdateWorkspaceLabelFilter, handleDeleteWorkspaceLabelFilter, handleArchiveWorkspaceEmail, handleTrashWorkspaceEmail, handleUntrashWorkspaceEmail, handleMarkWorkspaceEmailRead, handleMarkWorkspaceEmailUnread } from './gmail-handlers.js';
|
|
15
|
+
import { handleSearchWorkspaceEmails, handleGetWorkspaceEmailThread, handleComposeWorkspaceEmail, handleSendWorkspaceEmail, handleGetWorkspaceGmailSettings, handleUpdateWorkspaceVacationResponder, handleListWorkspaceSendAs, handleManageWorkspaceDraft, handleManageWorkspaceLabel, handleManageWorkspaceLabelAssignment, handleManageWorkspaceLabelFilter, handleManageWorkspaceAttachment, handleListWorkspaceDrafts, handleGetWorkspaceDraft, handleCreateWorkspaceDraft, handleUpdateWorkspaceDraft, handleDeleteWorkspaceDraft, handleSendWorkspaceDraft, handleDownloadWorkspaceAttachment, handleUploadWorkspaceAttachment, handleDeleteWorkspaceAttachment, handleListWorkspaceLabels, handleGetWorkspaceLabel, handleCreateWorkspaceLabel, handleUpdateWorkspaceLabel, handleDeleteWorkspaceLabel, handleListWorkspaceLabelFilters, handleCreateWorkspaceLabelFilter, handleUpdateWorkspaceLabelFilter, handleDeleteWorkspaceLabelFilter, handleArchiveWorkspaceEmail, handleTrashWorkspaceEmail, handleUntrashWorkspaceEmail, handleMarkWorkspaceEmailRead, handleMarkWorkspaceEmailUnread } from './gmail-handlers.js';
|
|
16
16
|
import { handleGetCurrentTime, handleFindFreeSlots, handleListWorkspaceCalendars, handleListWorkspaceCalendarEvents, handleGetWorkspaceCalendarEvent, handleManageWorkspaceCalendarEvent, handleCreateWorkspaceCalendarEvent, handleDeleteWorkspaceCalendarEvent } from './calendar-handlers.js';
|
|
17
|
-
import { handleListDriveFiles, handleSearchDriveFiles, handleListSharedDrives, handleUploadDriveFile, handleDownloadDriveFile, handleCreateDriveFolder, handleUpdateDrivePermissions, handleDeleteDriveFile, handleCopyDriveFile, handleMoveDriveFile, handleTrashDriveFile, handleUntrashDriveFile, handleListFileRevisions, handleDownloadFileRevision } from './drive-handlers.js';
|
|
17
|
+
import { handleListDriveFiles, handleSearchDriveFiles, handleListSharedDrives, handleUploadDriveFile, handleDownloadDriveFile, handleCreateDriveFolder, handleUpdateDrivePermissions, handleDeleteDriveFile, handleCopyDriveFile, handleMoveDriveFile, handleTrashDriveFile, handleUntrashDriveFile, handleListFileRevisions, handleDownloadFileRevision, handleQueryDriveActivity } from './drive-handlers.js';
|
|
18
18
|
// Import contact handlers
|
|
19
|
-
import { handleGetContacts, handleSearchContacts } from './contacts-handlers.js';
|
|
19
|
+
import { handleGetContacts, handleSearchContacts, handleCreateContact, handleUpdateContact } from './contacts-handlers.js';
|
|
20
20
|
// Import docs handlers
|
|
21
21
|
import { handleReadDocument, handleCreateDocument, handleAppendDocument, handleReplaceDocument, handleFindAndReplace, handleExtractDocumentId, handleListDocumentTabs, handleBatchUpdateDocument } from './docs-handlers.js';
|
|
22
22
|
// Import comments handlers
|
|
@@ -29,6 +29,10 @@ import { handleReadSpreadsheet, handleReadSpreadsheetValues, handleCreateSpreads
|
|
|
29
29
|
import { handleListTaskLists, handleListTasks, handleCreateTask, handleUpdateTask, handleCompleteTask, handleDeleteTask } from './tasks-handlers.js';
|
|
30
30
|
// Import forms handlers
|
|
31
31
|
import { handleListForms, handleGetForm, handleListFormResponses, handleGetFormResponse } from './forms-handlers.js';
|
|
32
|
+
// Import chat handlers
|
|
33
|
+
import { handleListChatSpaces, handleListChatMessages, handleSendChatMessage } from './chat-handlers.js';
|
|
34
|
+
// Import meet handlers
|
|
35
|
+
import { handleListMeetConferenceRecords, handleListMeetTranscripts, handleGetMeetTranscriptEntries } from './meet-handlers.js';
|
|
32
36
|
// Import error types
|
|
33
37
|
import { AccountError } from '../modules/accounts/types.js';
|
|
34
38
|
import { GmailError } from '../modules/gmail/types.js';
|
|
@@ -192,6 +196,14 @@ export class GSuiteServer {
|
|
|
192
196
|
assertBaseToolArguments(args);
|
|
193
197
|
result = await handleGetWorkspaceGmailSettings(args);
|
|
194
198
|
break;
|
|
199
|
+
case 'update_workspace_vacation_responder':
|
|
200
|
+
assertBaseToolArguments(args);
|
|
201
|
+
result = await handleUpdateWorkspaceVacationResponder(args);
|
|
202
|
+
break;
|
|
203
|
+
case 'list_workspace_send_as':
|
|
204
|
+
assertBaseToolArguments(args);
|
|
205
|
+
result = await handleListWorkspaceSendAs(args);
|
|
206
|
+
break;
|
|
195
207
|
// Gmail Quick Actions
|
|
196
208
|
case 'archive_workspace_email':
|
|
197
209
|
assertGmailQuickActionArgs(args);
|
|
@@ -406,6 +418,10 @@ export class GSuiteServer {
|
|
|
406
418
|
assertDriveDownloadRevisionArgs(args);
|
|
407
419
|
result = await handleDownloadFileRevision(args);
|
|
408
420
|
break;
|
|
421
|
+
case 'query_drive_activity':
|
|
422
|
+
assertBaseToolArguments(args);
|
|
423
|
+
result = await handleQueryDriveActivity(args);
|
|
424
|
+
break;
|
|
409
425
|
// Contact Operations
|
|
410
426
|
case 'get_workspace_contacts':
|
|
411
427
|
assertGetContactsParams(args);
|
|
@@ -415,6 +431,14 @@ export class GSuiteServer {
|
|
|
415
431
|
assertBaseToolArguments(args);
|
|
416
432
|
result = await handleSearchContacts(args);
|
|
417
433
|
break;
|
|
434
|
+
case 'create_workspace_contact':
|
|
435
|
+
assertBaseToolArguments(args);
|
|
436
|
+
result = await handleCreateContact(args);
|
|
437
|
+
break;
|
|
438
|
+
case 'update_workspace_contact':
|
|
439
|
+
assertBaseToolArguments(args);
|
|
440
|
+
result = await handleUpdateContact(args);
|
|
441
|
+
break;
|
|
418
442
|
// Google Docs Operations
|
|
419
443
|
case 'read_workspace_document':
|
|
420
444
|
assertReadDocumentArgs(args);
|
|
@@ -597,6 +621,32 @@ export class GSuiteServer {
|
|
|
597
621
|
assertGetFormResponseArgs(args);
|
|
598
622
|
result = await handleGetFormResponse(args);
|
|
599
623
|
break;
|
|
624
|
+
// Google Chat Operations
|
|
625
|
+
case 'list_chat_spaces':
|
|
626
|
+
assertBaseToolArguments(args);
|
|
627
|
+
result = await handleListChatSpaces(args);
|
|
628
|
+
break;
|
|
629
|
+
case 'list_chat_messages':
|
|
630
|
+
assertBaseToolArguments(args);
|
|
631
|
+
result = await handleListChatMessages(args);
|
|
632
|
+
break;
|
|
633
|
+
case 'send_chat_message':
|
|
634
|
+
assertBaseToolArguments(args);
|
|
635
|
+
result = await handleSendChatMessage(args);
|
|
636
|
+
break;
|
|
637
|
+
// Google Meet Operations (read-only)
|
|
638
|
+
case 'list_meet_conference_records':
|
|
639
|
+
assertBaseToolArguments(args);
|
|
640
|
+
result = await handleListMeetConferenceRecords(args);
|
|
641
|
+
break;
|
|
642
|
+
case 'list_meet_transcripts':
|
|
643
|
+
assertBaseToolArguments(args);
|
|
644
|
+
result = await handleListMeetTranscripts(args);
|
|
645
|
+
break;
|
|
646
|
+
case 'get_meet_transcript_entries':
|
|
647
|
+
assertBaseToolArguments(args);
|
|
648
|
+
result = await handleGetMeetTranscriptEntries(args);
|
|
649
|
+
break;
|
|
600
650
|
default:
|
|
601
651
|
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
602
652
|
}
|
package/dist/utils/apiError.js
CHANGED
|
@@ -52,11 +52,14 @@ export function hasErrorDetails(error) {
|
|
|
52
52
|
* Auth-handoff error codes: a domain error (AccountError / CalendarError / …)
|
|
53
53
|
* carrying one of these codes must NOT be wrapped into a generic McpError —
|
|
54
54
|
* `server.ts` `formatErrorResponse` keys the structured `auth_required`
|
|
55
|
-
* reconnect handoff on the raw domain error's string `code`.
|
|
55
|
+
* reconnect handoff on the raw domain error's string `code`. TEMPORARY_AUTH_ERROR
|
|
56
|
+
* (a transient refresh blip) is included so its "try again" resolution survives
|
|
57
|
+
* to the user; formatErrorResponse deliberately does NOT map it to the
|
|
58
|
+
* reconnect CTA. Kept as a
|
|
56
59
|
* structural check (no class import) so it works uniformly across every domain
|
|
57
60
|
* error type without coupling this util to the accounts/calendar/gmail modules.
|
|
58
61
|
*/
|
|
59
|
-
const AUTH_HANDOFF_CODES = new Set(['AUTH_REQUIRED', 'HOST_ORCHESTRATED_AUTH_REQUIRED']);
|
|
62
|
+
const AUTH_HANDOFF_CODES = new Set(['AUTH_REQUIRED', 'HOST_ORCHESTRATED_AUTH_REQUIRED', 'TEMPORARY_AUTH_ERROR']);
|
|
60
63
|
/**
|
|
61
64
|
* True when `error` is a thrown value that signals the account needs
|
|
62
65
|
* (re)authentication — i.e. it exposes a string `code` in {@link AUTH_HANDOFF_CODES}.
|
|
@@ -52,6 +52,10 @@ const SCOPE_HIERARCHY = {
|
|
|
52
52
|
[`${SCOPE_BASE}presentations`]: [
|
|
53
53
|
`${SCOPE_BASE}presentations.readonly`,
|
|
54
54
|
],
|
|
55
|
+
// Contacts: full access includes readonly
|
|
56
|
+
[`${SCOPE_BASE}contacts`]: [
|
|
57
|
+
`${SCOPE_BASE}contacts.readonly`,
|
|
58
|
+
],
|
|
55
59
|
};
|
|
56
60
|
/**
|
|
57
61
|
* Service-friendly names for scopes (used in error messages)
|
|
@@ -71,16 +75,22 @@ export const SCOPE_SERVICE_NAMES = {
|
|
|
71
75
|
[`${SCOPE_BASE}drive.readonly`]: 'Drive',
|
|
72
76
|
[`${SCOPE_BASE}drive.file`]: 'Drive',
|
|
73
77
|
[`${SCOPE_BASE}drive.appdata`]: 'Drive',
|
|
78
|
+
[`${SCOPE_BASE}drive.activity.readonly`]: 'Drive Activity',
|
|
74
79
|
[`${SCOPE_BASE}documents`]: 'Google Docs',
|
|
75
80
|
[`${SCOPE_BASE}documents.readonly`]: 'Google Docs',
|
|
76
81
|
[`${SCOPE_BASE}spreadsheets`]: 'Google Sheets',
|
|
77
82
|
[`${SCOPE_BASE}spreadsheets.readonly`]: 'Google Sheets',
|
|
78
83
|
[`${SCOPE_BASE}presentations`]: 'Google Slides',
|
|
79
84
|
[`${SCOPE_BASE}presentations.readonly`]: 'Google Slides',
|
|
85
|
+
[`${SCOPE_BASE}contacts`]: 'Contacts',
|
|
80
86
|
[`${SCOPE_BASE}contacts.readonly`]: 'Contacts',
|
|
81
87
|
[`${SCOPE_BASE}tasks`]: 'Google Tasks',
|
|
82
88
|
[`${SCOPE_BASE}forms.body.readonly`]: 'Google Forms',
|
|
83
89
|
[`${SCOPE_BASE}forms.responses.readonly`]: 'Google Forms Responses',
|
|
90
|
+
[`${SCOPE_BASE}chat.spaces.readonly`]: 'Google Chat',
|
|
91
|
+
[`${SCOPE_BASE}chat.messages.readonly`]: 'Google Chat',
|
|
92
|
+
[`${SCOPE_BASE}chat.messages.create`]: 'Google Chat',
|
|
93
|
+
[`${SCOPE_BASE}meetings.space.readonly`]: 'Google Meet',
|
|
84
94
|
};
|
|
85
95
|
/**
|
|
86
96
|
* Check if a required scope is satisfied by the granted scopes.
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Feature flag for Tasks and Forms APIs.
|
|
3
|
-
*
|
|
4
|
-
* These features require additional OAuth scopes that need to be configured
|
|
5
|
-
* in the Google Cloud Console and may require Google verification.
|
|
6
|
-
* Set ENABLE_GOOGLE_TASKS_FORMS=true to enable once scopes are configured.
|
|
7
|
-
*
|
|
8
|
-
* See: docs/plans/finished/260116_GoogleWorkspace_MCP_Improvements.md
|
|
9
|
-
*/
|
|
10
|
-
export declare const TASKS_FORMS_ENABLED: boolean;
|
|
11
1
|
export declare function initializeAllServices(): Promise<void>;
|
|
12
2
|
//# sourceMappingURL=service-initializer.d.ts.map
|
|
@@ -8,6 +8,8 @@ import { initializeCommentsModule } from '../modules/comments/index.js';
|
|
|
8
8
|
import { initializeSlidesModule } from '../modules/slides/index.js';
|
|
9
9
|
import { initializeSheetsModule } from '../modules/sheets/index.js';
|
|
10
10
|
import { initializeContactsModule } from '../modules/contacts/index.js';
|
|
11
|
+
import { initializeChatModule } from '../modules/chat/index.js';
|
|
12
|
+
import { initializeMeetModule } from '../modules/meet/index.js';
|
|
11
13
|
import { initializeTasksModule } from '../modules/tasks/index.js';
|
|
12
14
|
import { initializeFormsModule } from '../modules/forms/index.js';
|
|
13
15
|
import { registerGmailScopes } from '../modules/gmail/scopes.js';
|
|
@@ -16,24 +18,17 @@ import { registerDriveScopes } from '../modules/drive/scopes.js';
|
|
|
16
18
|
import { registerDocsScopes } from '../modules/docs/scopes.js';
|
|
17
19
|
import { registerSlidesScopes } from '../modules/slides/scopes.js';
|
|
18
20
|
import { registerSheetsScopes } from '../modules/sheets/scopes.js';
|
|
21
|
+
import { registerChatScopes } from '../modules/chat/scopes.js';
|
|
22
|
+
import { registerMeetScopes } from '../modules/meet/scopes.js';
|
|
19
23
|
import { registerTasksScopes } from '../modules/tasks/scopes.js';
|
|
20
24
|
import { registerFormsScopes } from '../modules/forms/scopes.js';
|
|
21
25
|
import { CONTACTS_SCOPES } from '../modules/contacts/scopes.js';
|
|
22
26
|
import { scopeRegistry } from '../modules/tools/scope-registry.js';
|
|
23
27
|
import { applyDefaultGoogleRequestOptions } from './request-timeout.js';
|
|
24
|
-
/**
|
|
25
|
-
* Feature flag for Tasks and Forms APIs.
|
|
26
|
-
*
|
|
27
|
-
* These features require additional OAuth scopes that need to be configured
|
|
28
|
-
* in the Google Cloud Console and may require Google verification.
|
|
29
|
-
* Set ENABLE_GOOGLE_TASKS_FORMS=true to enable once scopes are configured.
|
|
30
|
-
*
|
|
31
|
-
* See: docs/plans/finished/260116_GoogleWorkspace_MCP_Improvements.md
|
|
32
|
-
*/
|
|
33
|
-
export const TASKS_FORMS_ENABLED = process.env.ENABLE_GOOGLE_TASKS_FORMS === 'true';
|
|
34
28
|
// Function to register contacts scopes
|
|
35
29
|
function registerContactsScopes() {
|
|
36
30
|
scopeRegistry.registerScope("contacts", CONTACTS_SCOPES.READONLY);
|
|
31
|
+
scopeRegistry.registerScope("contacts", CONTACTS_SCOPES.CONTACTS);
|
|
37
32
|
logger.info('Contacts scopes registered');
|
|
38
33
|
}
|
|
39
34
|
export async function initializeAllServices() {
|
|
@@ -48,15 +43,11 @@ export async function initializeAllServices() {
|
|
|
48
43
|
registerSlidesScopes();
|
|
49
44
|
registerSheetsScopes();
|
|
50
45
|
registerContactsScopes();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
logger.info('Tasks and Forms disabled (set ENABLE_GOOGLE_TASKS_FORMS=true to enable)');
|
|
59
|
-
}
|
|
46
|
+
registerChatScopes();
|
|
47
|
+
registerMeetScopes();
|
|
48
|
+
registerTasksScopes();
|
|
49
|
+
registerFormsScopes();
|
|
50
|
+
logger.info('Tasks and Forms scopes registered');
|
|
60
51
|
// Initialize account module first as other services depend on it
|
|
61
52
|
logger.info('Initializing account module...');
|
|
62
53
|
await initializeAccountModule();
|
|
@@ -71,11 +62,11 @@ export async function initializeAllServices() {
|
|
|
71
62
|
initializeGmailModule().then(() => logger.info('Gmail module initialized')),
|
|
72
63
|
initializeCalendarModule().then(() => logger.info('Calendar module initialized')),
|
|
73
64
|
initializeContactsModule().then(() => logger.info('Contacts module initialized')),
|
|
65
|
+
initializeChatModule().then(() => logger.info('Chat module initialized')),
|
|
66
|
+
initializeMeetModule().then(() => logger.info('Meet module initialized')),
|
|
67
|
+
initializeTasksModule().then(() => logger.info('Tasks module initialized')),
|
|
68
|
+
initializeFormsModule().then(() => logger.info('Forms module initialized')),
|
|
74
69
|
];
|
|
75
|
-
// Only initialize Tasks and Forms if enabled
|
|
76
|
-
if (TASKS_FORMS_ENABLED) {
|
|
77
|
-
modulePromises.push(initializeTasksModule().then(() => logger.info('Tasks module initialized')), initializeFormsModule().then(() => logger.info('Forms module initialized')));
|
|
78
|
-
}
|
|
79
70
|
await Promise.all(modulePromises);
|
|
80
71
|
logger.info('All services initialized successfully');
|
|
81
72
|
}
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md security invariant #6 — content fetched from an external system
|
|
3
|
+
* MUST be wrapped in an `<untrusted-content source="…">…</untrusted-content>`
|
|
4
|
+
* envelope (with close-tag breakout escaping) before it is returned to the
|
|
5
|
+
* LLM, so the model treats third-party / attacker-controllable text as DATA,
|
|
6
|
+
* not as instructions.
|
|
7
|
+
*
|
|
8
|
+
* This is the canonical implementation a new connector ships with. It is a
|
|
9
|
+
* VENDORED copy of the shared reference in `test-harness/src/untrusted-content.ts`
|
|
10
|
+
* — connectors cannot `import` the test-harness at runtime (it is a
|
|
11
|
+
* test/dev-only `file:` dependency that is never published into a connector's
|
|
12
|
+
* `dist/`), so the helper lives in the connector's own runtime source. Keep
|
|
13
|
+
* this byte-for-byte in sync with the shared reference; do NOT weaken the
|
|
14
|
+
* escaping back to a simple `replaceAll` (that family misses whitespace / case
|
|
15
|
+
* close-tag variants like `</untrusted-content >` / `</UNTRUSTED-CONTENT>`).
|
|
16
|
+
*
|
|
17
|
+
* `scripts/check-untrusted-coverage.mjs` greps for a reference to
|
|
18
|
+
* `untrusted-content` in any connector that talks to an external system; this
|
|
19
|
+
* file (and the call sites that import from it) is what satisfies that gate.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a single untrusted string in an `<untrusted-content source="…">`
|
|
23
|
+
* envelope, escaping any embedded close-tag variant so the envelope cannot be
|
|
24
|
+
* broken out of. `undefined` passes through untouched. Idempotent for the same
|
|
25
|
+
* `source`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function wrapUntrusted(text: string | null | undefined, source: string): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Recursively wrap every string value reachable inside `value`. Object keys are
|
|
30
|
+
* structural and NOT wrapped; non-string leaves pass through unchanged.
|
|
31
|
+
*/
|
|
2
32
|
export declare function wrapUntrustedJsonStrings<T>(value: T, source: string): T;
|
|
33
|
+
/**
|
|
34
|
+
* Connector-local alias for `wrapUntrusted` under the name the existing call
|
|
35
|
+
* sites were written against. `content` is required (never `undefined`), so
|
|
36
|
+
* the result is always a string.
|
|
37
|
+
*/
|
|
38
|
+
export declare function wrapUntrustedContent(content: string, source: string): string;
|
|
3
39
|
//# sourceMappingURL=untrusted-content.d.ts.map
|