gogcli-mcp 2.25.0 → 2.27.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +10 -5
- package/SKILL.md +11 -6
- package/dist/index.js +553 -128
- package/dist/lib.js +480 -89
- package/manifest.json +89 -1
- package/mint.yaml +106 -0
- package/package.json +5 -5
- package/server.json +2 -2
- package/src/gmail-results.ts +29 -2
- package/src/lib.ts +8 -0
- package/src/runner.ts +1 -1
- package/src/server.ts +6 -0
- package/src/tools/appscript.ts +173 -0
- package/src/tools/calendar.ts +56 -2
- package/src/tools/chat.ts +253 -0
- package/src/tools/gmail.ts +136 -5
- package/src/tools/utils.ts +20 -0
- package/src/worker.ts +1 -1
- package/tests/gmail-results.test.ts +47 -0
- package/tests/server.test.ts +61 -0
- package/tests/tools/appscript.test.ts +159 -0
- package/tests/tools/calendar.test.ts +121 -0
- package/tests/tools/chat.test.ts +284 -0
- package/tests/tools/gmail.test.ts +320 -0
package/dist/index.js
CHANGED
|
@@ -31000,9 +31000,82 @@ var StdioServerTransport = class {
|
|
|
31000
31000
|
}
|
|
31001
31001
|
};
|
|
31002
31002
|
|
|
31003
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/errors/index.js
|
|
31004
|
+
var McpToolError = class extends Error {
|
|
31005
|
+
/** Actionable remediation text, when one applies. */
|
|
31006
|
+
hint;
|
|
31007
|
+
constructor(message, opts) {
|
|
31008
|
+
super(message, opts?.cause !== void 0 ? { cause: opts.cause } : void 0);
|
|
31009
|
+
this.name = "McpToolError";
|
|
31010
|
+
if (opts?.hint !== void 0)
|
|
31011
|
+
this.hint = opts.hint;
|
|
31012
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
31013
|
+
}
|
|
31014
|
+
};
|
|
31015
|
+
var BEARER_RE = /(bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi;
|
|
31016
|
+
var JWT_RE = /\b[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
31017
|
+
var BASIC_AUTH_RE = /(authorization\s*:\s*basic\s+)[A-Za-z0-9+/=_-]{6,}/gi;
|
|
31018
|
+
var SET_COOKIE_RE = /(\bset-cookie\s*:\s*)([^=;,\s]+)=[^;,\s]*/gi;
|
|
31019
|
+
var COOKIE_HEADER_RE = /((?<!set-)\bcookie\s*:\s*)((?:[^=;,\s]+=[^;,\s]*)(?:;\s*[^=;,\s]+=[^;,\s]*)*)/gi;
|
|
31020
|
+
var API_KEY_RE = new RegExp([
|
|
31021
|
+
"sk-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])",
|
|
31022
|
+
// OpenAI / Anthropic (incl. sk-ant-…)
|
|
31023
|
+
"gh[pousr]_[A-Za-z0-9]{36,}\\b",
|
|
31024
|
+
// GitHub ghp_/gho_/ghu_/ghs_/ghr_
|
|
31025
|
+
"xox[baprs]-[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])",
|
|
31026
|
+
// Slack
|
|
31027
|
+
"AIza[0-9A-Za-z_-]{35}(?![0-9A-Za-z_-])",
|
|
31028
|
+
// Google API key (39 chars total)
|
|
31029
|
+
"AKIA[0-9A-Z]{16}\\b",
|
|
31030
|
+
// AWS access key id (20 chars total)
|
|
31031
|
+
"whsec_[A-Za-z0-9]{16,}\\b"
|
|
31032
|
+
// webhook signing secret (Stripe-style)
|
|
31033
|
+
].map((p) => `\\b${p}`).join("|"), "g");
|
|
31034
|
+
var QUERY_SECRET_RE = /([?&](?:access_token|refresh_token|client_secret|api_?key|signature|token|key|sig)=)[^&#\s"'<>`]+/gi;
|
|
31035
|
+
var AWS_SIGV4_RE = /([?&]X-Amz-(?:Signature|Security-Token|Credential)=)[^&#\s"'<>`]+/gi;
|
|
31036
|
+
var JSON_SECRET_KEYS = "access_token|refresh_token|client_secret|api_?key|password|passwd|secret|token";
|
|
31037
|
+
var JSON_SECRET_DQ_RE = new RegExp(`("(?:${JSON_SECRET_KEYS})"\\s*:\\s*")[^"]*(")`, "gi");
|
|
31038
|
+
var JSON_SECRET_SQ_RE = new RegExp(`('(?:${JSON_SECRET_KEYS})'\\s*:\\s*')[^']*(')`, "gi");
|
|
31039
|
+
function redactSecrets(text) {
|
|
31040
|
+
return text.replace(BEARER_RE, "$1[REDACTED]").replace(BASIC_AUTH_RE, "$1[REDACTED]").replace(SET_COOKIE_RE, "$1$2=[REDACTED]").replace(COOKIE_HEADER_RE, (_m, prefix, pairs) => `${prefix}${pairs.replace(/=[^;,\s]*/g, "=[REDACTED]")}`).replace(API_KEY_RE, "[REDACTED]").replace(QUERY_SECRET_RE, "$1[REDACTED]").replace(AWS_SIGV4_RE, "$1[REDACTED]").replace(JSON_SECRET_DQ_RE, "$1[REDACTED]$2").replace(JSON_SECRET_SQ_RE, "$1[REDACTED]$2").replace(JWT_RE, "[REDACTED]");
|
|
31041
|
+
}
|
|
31042
|
+
|
|
31043
|
+
// ../../node_modules/@chrischall/mcp-utils/dist/response/index.js
|
|
31044
|
+
function rawTextResult(text) {
|
|
31045
|
+
return { content: [{ type: "text", text }] };
|
|
31046
|
+
}
|
|
31047
|
+
function errorResult(message) {
|
|
31048
|
+
return {
|
|
31049
|
+
content: [{ type: "text", text: redactSecrets(message) }],
|
|
31050
|
+
isError: true
|
|
31051
|
+
};
|
|
31052
|
+
}
|
|
31053
|
+
|
|
31003
31054
|
// ../../node_modules/@chrischall/mcp-utils/dist/server/index.js
|
|
31055
|
+
function hintResultOrRethrow(err) {
|
|
31056
|
+
if (err instanceof McpToolError && err.hint) {
|
|
31057
|
+
return errorResult(`${err.message}
|
|
31058
|
+
|
|
31059
|
+
Hint: ${err.hint}`);
|
|
31060
|
+
}
|
|
31061
|
+
throw err;
|
|
31062
|
+
}
|
|
31063
|
+
function surfaceToolHints(server) {
|
|
31064
|
+
const register = server.registerTool.bind(server);
|
|
31065
|
+
server.registerTool = (name, config2, cb) => register(name, config2, (...args) => {
|
|
31066
|
+
let result;
|
|
31067
|
+
try {
|
|
31068
|
+
result = cb(...args);
|
|
31069
|
+
} catch (err) {
|
|
31070
|
+
return hintResultOrRethrow(err);
|
|
31071
|
+
}
|
|
31072
|
+
return result instanceof Promise ? result.catch(hintResultOrRethrow) : result;
|
|
31073
|
+
});
|
|
31074
|
+
}
|
|
31004
31075
|
async function createMcpServer(opts) {
|
|
31005
31076
|
const server = new McpServer({ name: opts.name, version: opts.version });
|
|
31077
|
+
if (opts.surfaceHints !== false)
|
|
31078
|
+
surfaceToolHints(server);
|
|
31006
31079
|
if (opts.banner !== void 0) {
|
|
31007
31080
|
console.error(opts.banner);
|
|
31008
31081
|
}
|
|
@@ -31047,46 +31120,6 @@ async function runMcp(opts) {
|
|
|
31047
31120
|
return server;
|
|
31048
31121
|
}
|
|
31049
31122
|
|
|
31050
|
-
// ../../node_modules/@chrischall/mcp-utils/dist/errors/index.js
|
|
31051
|
-
var BEARER_RE = /(bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi;
|
|
31052
|
-
var JWT_RE = /\b[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{8,}\b/g;
|
|
31053
|
-
var BASIC_AUTH_RE = /(authorization\s*:\s*basic\s+)[A-Za-z0-9+/=_-]{6,}/gi;
|
|
31054
|
-
var SET_COOKIE_RE = /(\bset-cookie\s*:\s*)([^=;,\s]+)=[^;,\s]*/gi;
|
|
31055
|
-
var COOKIE_HEADER_RE = /((?<!set-)\bcookie\s*:\s*)((?:[^=;,\s]+=[^;,\s]*)(?:;\s*[^=;,\s]+=[^;,\s]*)*)/gi;
|
|
31056
|
-
var API_KEY_RE = new RegExp([
|
|
31057
|
-
"sk-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])",
|
|
31058
|
-
// OpenAI / Anthropic (incl. sk-ant-…)
|
|
31059
|
-
"gh[pousr]_[A-Za-z0-9]{36,}\\b",
|
|
31060
|
-
// GitHub ghp_/gho_/ghu_/ghs_/ghr_
|
|
31061
|
-
"xox[baprs]-[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])",
|
|
31062
|
-
// Slack
|
|
31063
|
-
"AIza[0-9A-Za-z_-]{35}(?![0-9A-Za-z_-])",
|
|
31064
|
-
// Google API key (39 chars total)
|
|
31065
|
-
"AKIA[0-9A-Z]{16}\\b",
|
|
31066
|
-
// AWS access key id (20 chars total)
|
|
31067
|
-
"whsec_[A-Za-z0-9]{16,}\\b"
|
|
31068
|
-
// webhook signing secret (Stripe-style)
|
|
31069
|
-
].map((p) => `\\b${p}`).join("|"), "g");
|
|
31070
|
-
var QUERY_SECRET_RE = /([?&](?:access_token|refresh_token|client_secret|api_?key|signature|token|key|sig)=)[^&#\s"'<>`]+/gi;
|
|
31071
|
-
var AWS_SIGV4_RE = /([?&]X-Amz-(?:Signature|Security-Token|Credential)=)[^&#\s"'<>`]+/gi;
|
|
31072
|
-
var JSON_SECRET_KEYS = "access_token|refresh_token|client_secret|api_?key|password|passwd|secret|token";
|
|
31073
|
-
var JSON_SECRET_DQ_RE = new RegExp(`("(?:${JSON_SECRET_KEYS})"\\s*:\\s*")[^"]*(")`, "gi");
|
|
31074
|
-
var JSON_SECRET_SQ_RE = new RegExp(`('(?:${JSON_SECRET_KEYS})'\\s*:\\s*')[^']*(')`, "gi");
|
|
31075
|
-
function redactSecrets(text) {
|
|
31076
|
-
return text.replace(BEARER_RE, "$1[REDACTED]").replace(BASIC_AUTH_RE, "$1[REDACTED]").replace(SET_COOKIE_RE, "$1$2=[REDACTED]").replace(COOKIE_HEADER_RE, (_m, prefix, pairs) => `${prefix}${pairs.replace(/=[^;,\s]*/g, "=[REDACTED]")}`).replace(API_KEY_RE, "[REDACTED]").replace(QUERY_SECRET_RE, "$1[REDACTED]").replace(AWS_SIGV4_RE, "$1[REDACTED]").replace(JSON_SECRET_DQ_RE, "$1[REDACTED]$2").replace(JSON_SECRET_SQ_RE, "$1[REDACTED]$2").replace(JWT_RE, "[REDACTED]");
|
|
31077
|
-
}
|
|
31078
|
-
|
|
31079
|
-
// ../../node_modules/@chrischall/mcp-utils/dist/response/index.js
|
|
31080
|
-
function rawTextResult(text) {
|
|
31081
|
-
return { content: [{ type: "text", text }] };
|
|
31082
|
-
}
|
|
31083
|
-
function errorResult(message) {
|
|
31084
|
-
return {
|
|
31085
|
-
content: [{ type: "text", text: redactSecrets(message) }],
|
|
31086
|
-
isError: true
|
|
31087
|
-
};
|
|
31088
|
-
}
|
|
31089
|
-
|
|
31090
31123
|
// ../../node_modules/@chrischall/mcp-utils/dist/config/index.js
|
|
31091
31124
|
var PLACEHOLDER_RE = /^\$\{[^}]*\}$/;
|
|
31092
31125
|
function readEnvVar(key, opts = {}) {
|
|
@@ -31678,6 +31711,12 @@ var paginationParams = {
|
|
|
31678
31711
|
page: pageAliasParam,
|
|
31679
31712
|
all: external_exports.boolean().optional().describe("Fetch all pages")
|
|
31680
31713
|
};
|
|
31714
|
+
function pushPaginationFlags(args, p) {
|
|
31715
|
+
if (p.max !== void 0) args.push(`--max=${p.max}`);
|
|
31716
|
+
const token = resolvePageToken(p);
|
|
31717
|
+
if (token) args.push(`--page=${token}`);
|
|
31718
|
+
if (p.all) args.push("--all");
|
|
31719
|
+
}
|
|
31681
31720
|
function registerRunTool(server, options) {
|
|
31682
31721
|
const { service, examples, omitAccount = false, note } = options;
|
|
31683
31722
|
const baseDescription = `Run any gog ${service} subcommand not covered by the other tools. Run \`gog ${service} --help\` for the full list of subcommands, or \`gog ${service} <subcommand> --help\` for flags on a specific subcommand.`;
|
|
@@ -31796,6 +31835,13 @@ function formatAuthHealth(raw, now) {
|
|
|
31796
31835
|
}
|
|
31797
31836
|
return accounts.map((a) => formatOneAccountHealth(a, now)).join("\n\n");
|
|
31798
31837
|
}
|
|
31838
|
+
function assertNotBoth(inlineParam, fileParam, inlineValue, fileValue) {
|
|
31839
|
+
if (inlineValue !== void 0 && fileValue !== void 0) {
|
|
31840
|
+
throw new Error(
|
|
31841
|
+
`${inlineParam} and ${fileParam} are mutually exclusive \u2014 gog accepts only one of them. Pass ${inlineParam} with the content itself (it is written to a temp file automatically when large), or ${fileParam} with a path that already exists on the gog server.`
|
|
31842
|
+
);
|
|
31843
|
+
}
|
|
31844
|
+
}
|
|
31799
31845
|
|
|
31800
31846
|
// src/tools/api.ts
|
|
31801
31847
|
function registerApiTools(server) {
|
|
@@ -31851,6 +31897,117 @@ function registerApiTools(server) {
|
|
|
31851
31897
|
});
|
|
31852
31898
|
}
|
|
31853
31899
|
|
|
31900
|
+
// src/tools/appscript.ts
|
|
31901
|
+
function registerAppScriptTools(server) {
|
|
31902
|
+
const scriptIdParam = external_exports.string().describe(
|
|
31903
|
+
"Apps Script project ID \u2014 the long ID in script.google.com/\u2026/projects/<scriptId>/\u2026, NOT the Drive file ID of a container document"
|
|
31904
|
+
);
|
|
31905
|
+
const apiEnableNote = " Needs the Apps Script API enabled on the OAuth client's Google Cloud project; if it is not, gog says so and prints the console URL to enable it. That is a project setting, not a missing scope \u2014 re-authorizing will not fix it.";
|
|
31906
|
+
server.registerTool("gog_appscript_get", {
|
|
31907
|
+
description: "Get an Apps Script project's metadata: title, creator, create/update times, and the parent Drive file when the project is bound to a Sheet, Doc or Form. Use gog_appscript_content to read the actual code." + apiEnableNote,
|
|
31908
|
+
annotations: { readOnlyHint: true },
|
|
31909
|
+
inputSchema: {
|
|
31910
|
+
scriptId: scriptIdParam,
|
|
31911
|
+
account: accountParam
|
|
31912
|
+
}
|
|
31913
|
+
}, async ({ scriptId, account }) => {
|
|
31914
|
+
return runOrDiagnose(["appscript", "get", scriptId], { account });
|
|
31915
|
+
});
|
|
31916
|
+
server.registerTool("gog_appscript_content", {
|
|
31917
|
+
description: `Read a project's source \u2014 every .gs file and its appsscript.json manifest \u2014 INLINE in the response. This is the tool to reach for when the question is "what does this script do"; it needs no filesystem, so it works the same on a hosted deployment as it does locally, unlike gog_appscript_pull.` + apiEnableNote,
|
|
31918
|
+
annotations: { readOnlyHint: true },
|
|
31919
|
+
inputSchema: {
|
|
31920
|
+
scriptId: scriptIdParam,
|
|
31921
|
+
account: accountParam
|
|
31922
|
+
}
|
|
31923
|
+
}, async ({ scriptId, account }) => {
|
|
31924
|
+
return runOrDiagnose(["appscript", "content", scriptId], { account });
|
|
31925
|
+
});
|
|
31926
|
+
server.registerTool("gog_appscript_pull", {
|
|
31927
|
+
description: "Write a project's files into a local directory, for editing a script as ordinary files. THE DIRECTORY IS RESOLVED WHERE GOG RUNS, which is the caller's own machine only on a local (stdio) deployment: on the hosted connector, or any GOG_RUNNER_URL backend, the files land on that server where the caller cannot reach them. Use gog_appscript_content there instead \u2014 it returns the same source in the response. Existing files are left alone unless overwrite is set. Read-only as far as Google is concerned: nothing is pushed back." + apiEnableNote,
|
|
31928
|
+
inputSchema: {
|
|
31929
|
+
scriptId: scriptIdParam,
|
|
31930
|
+
dir: external_exports.string().describe("Destination directory, resolved on the machine where gog runs"),
|
|
31931
|
+
overwrite: external_exports.boolean().optional().describe("Overwrite files that already exist in dir"),
|
|
31932
|
+
account: accountParam
|
|
31933
|
+
}
|
|
31934
|
+
}, async ({ scriptId, dir, overwrite, account }) => {
|
|
31935
|
+
const args = ["appscript", "pull", scriptId, dir];
|
|
31936
|
+
if (overwrite) args.push("--overwrite");
|
|
31937
|
+
return runOrDiagnose(args, { account });
|
|
31938
|
+
});
|
|
31939
|
+
server.registerTool("gog_appscript_create", {
|
|
31940
|
+
description: "Create a new, empty Apps Script project. Pass parentId to bind it to a Drive file (a Sheet, Doc or Form), which is what makes the script a container-bound script with access to that document; omit it for a standalone project. gog cannot upload code, so the project starts empty either way." + apiEnableNote,
|
|
31941
|
+
inputSchema: {
|
|
31942
|
+
title: external_exports.string().describe("Project title"),
|
|
31943
|
+
parentId: external_exports.string().optional().describe("Drive file ID to bind the project to (Sheet, Doc or Form). Omit for a standalone project."),
|
|
31944
|
+
account: accountParam
|
|
31945
|
+
}
|
|
31946
|
+
}, async ({ title, parentId, account }) => {
|
|
31947
|
+
const args = ["appscript", "create", `--title=${title}`];
|
|
31948
|
+
if (parentId) args.push(`--parent-id=${parentId}`);
|
|
31949
|
+
return runOrDiagnose(args, { account });
|
|
31950
|
+
});
|
|
31951
|
+
server.registerTool("gog_appscript_deployments", {
|
|
31952
|
+
description: "List a project's deployments \u2014 the published web apps, add-ons and API executables, each pinned to a version. A deployment ID from here is what gog_appscript_run_function needs when a script is not running in dev mode." + apiEnableNote,
|
|
31953
|
+
annotations: { readOnlyHint: true },
|
|
31954
|
+
inputSchema: {
|
|
31955
|
+
scriptId: scriptIdParam,
|
|
31956
|
+
...paginationParams,
|
|
31957
|
+
account: accountParam
|
|
31958
|
+
}
|
|
31959
|
+
}, async ({ scriptId, max, pageToken, page, all, account }) => {
|
|
31960
|
+
const args = ["appscript", "deployments", scriptId];
|
|
31961
|
+
pushPaginationFlags(args, { max, pageToken, page, all });
|
|
31962
|
+
return runOrDiagnose(args, { account });
|
|
31963
|
+
});
|
|
31964
|
+
server.registerTool("gog_appscript_versions", {
|
|
31965
|
+
description: `List a project's saved versions \u2014 the immutable snapshots deployments point at, with their numbers and descriptions. Useful for answering "what is actually deployed" next to gog_appscript_deployments.` + apiEnableNote,
|
|
31966
|
+
annotations: { readOnlyHint: true },
|
|
31967
|
+
inputSchema: {
|
|
31968
|
+
scriptId: scriptIdParam,
|
|
31969
|
+
...paginationParams,
|
|
31970
|
+
account: accountParam
|
|
31971
|
+
}
|
|
31972
|
+
}, async ({ scriptId, max, pageToken, page, all, account }) => {
|
|
31973
|
+
const args = ["appscript", "versions", scriptId];
|
|
31974
|
+
pushPaginationFlags(args, { max, pageToken, page, all });
|
|
31975
|
+
return runOrDiagnose(args, { account });
|
|
31976
|
+
});
|
|
31977
|
+
server.registerTool("gog_appscript_run_function", {
|
|
31978
|
+
description: "Execute a function in a deployed Apps Script project. TREAT THIS AS ARBITRARY CODE EXECUTION: the script runs with this Google account's authority and can send mail, edit Drive files or call external services, and the wrapper cannot tell a read from a write \u2014 read the code with gog_appscript_content first if you did not write it. Requires the project to be deployed as an API executable and to share the OAuth client with the calling credentials, otherwise Google refuses regardless of scopes. devMode runs the latest saved code instead of the deployed version, and only works if the account owns the script. This is NOT the escape hatch \u2014 gog_appscript_run is that." + apiEnableNote,
|
|
31979
|
+
annotations: { destructiveHint: true },
|
|
31980
|
+
inputSchema: {
|
|
31981
|
+
scriptId: scriptIdParam,
|
|
31982
|
+
functionName: external_exports.string().describe('Name of the function to call, e.g. "doWork"'),
|
|
31983
|
+
params: external_exports.string().optional().describe(`Function parameters as a JSON ARRAY of positional arguments, e.g. '["a", 1]' \u2014 not an object`),
|
|
31984
|
+
devMode: external_exports.boolean().optional().describe("Run the latest saved code rather than the deployed version (owner only)"),
|
|
31985
|
+
account: accountParam
|
|
31986
|
+
}
|
|
31987
|
+
}, async ({ scriptId, functionName, params, devMode, account }) => {
|
|
31988
|
+
if (params !== void 0) {
|
|
31989
|
+
let parsed;
|
|
31990
|
+
try {
|
|
31991
|
+
parsed = JSON.parse(params);
|
|
31992
|
+
} catch {
|
|
31993
|
+
throw new Error(`params must be a JSON array of positional arguments, e.g. '["a", 1]'. Received: ${params}`);
|
|
31994
|
+
}
|
|
31995
|
+
if (!Array.isArray(parsed)) {
|
|
31996
|
+
throw new Error(`params must be a JSON ARRAY of positional arguments, e.g. '["a", 1]' \u2014 Apps Script takes positional arguments, not named ones. Received: ${params}`);
|
|
31997
|
+
}
|
|
31998
|
+
}
|
|
31999
|
+
const args = ["appscript", "run", scriptId, functionName];
|
|
32000
|
+
if (params !== void 0) args.push(`--params=${params}`);
|
|
32001
|
+
if (devMode) args.push("--dev-mode");
|
|
32002
|
+
return runOrDiagnose(args, { account });
|
|
32003
|
+
});
|
|
32004
|
+
registerRunTool(server, {
|
|
32005
|
+
service: "appscript",
|
|
32006
|
+
examples: '"get", "content", "deployments"',
|
|
32007
|
+
note: "To execute a function, use gog_appscript_run_function \u2014 this tool is the generic escape hatch."
|
|
32008
|
+
});
|
|
32009
|
+
}
|
|
32010
|
+
|
|
31854
32011
|
// src/tools/auth.ts
|
|
31855
32012
|
function registerAuthToolsWith(server, defaultServices) {
|
|
31856
32013
|
const servicesDescribe = `Services to authorize: "all" or comma-separated list (e.g. "sheets,gmail,calendar"). Default: "${defaultServices}". Prefer the narrowest set you need \u2014 requesting a service whose Google API is not enabled on the OAuth client's project makes Google reject the WHOLE request with invalid_scope.`;
|
|
@@ -31983,6 +32140,29 @@ function registerAuthTools(server) {
|
|
|
31983
32140
|
}
|
|
31984
32141
|
|
|
31985
32142
|
// src/tools/calendar.ts
|
|
32143
|
+
var reminderParams = {
|
|
32144
|
+
reminders: external_exports.array(external_exports.string()).max(5).optional().describe(
|
|
32145
|
+
`Reminders as method:duration, e.g. ["popup:30m", "email:1d"]. Method is popup or email; duration accepts m/h/d (max 40320 minutes = 4 weeks). Google allows at most 5. These REPLACE the event's reminders \u2014 on update, pass an EMPTY array to drop custom reminders and go back to the calendar's defaults. Cannot be combined with noReminders.`
|
|
32146
|
+
),
|
|
32147
|
+
noReminders: external_exports.boolean().optional().describe(
|
|
32148
|
+
"Give the event no reminders at all, overriding the calendar's defaults. Different from an empty reminders array, which RESTORES those defaults. Cannot be combined with reminders."
|
|
32149
|
+
)
|
|
32150
|
+
};
|
|
32151
|
+
function pushReminderFlags(args, p) {
|
|
32152
|
+
if (p.noReminders) {
|
|
32153
|
+
if (p.reminders !== void 0) {
|
|
32154
|
+
throw new Error("reminders and noReminders are mutually exclusive: pass reminders to set custom ones, noReminders for none, or an empty reminders array to restore the calendar defaults.");
|
|
32155
|
+
}
|
|
32156
|
+
args.push("--no-reminders");
|
|
32157
|
+
return;
|
|
32158
|
+
}
|
|
32159
|
+
if (p.reminders === void 0) return;
|
|
32160
|
+
if (p.reminders.length === 0) {
|
|
32161
|
+
args.push("--reminder=");
|
|
32162
|
+
return;
|
|
32163
|
+
}
|
|
32164
|
+
for (const reminder of p.reminders) args.push(`--reminder=${reminder}`);
|
|
32165
|
+
}
|
|
31986
32166
|
function registerCalendarTools(server) {
|
|
31987
32167
|
server.registerTool("gog_calendar_events", {
|
|
31988
32168
|
description: 'List calendar events. Describe the window ONE way and one way only (gog >= 0.36.0 rejects the rest as ambiguous rather than silently discarding a flag): today on its own; or from + to; or from + days; or days on its own (a window of that many days starting today). today cannot be combined with from, to or days, and days cannot be combined with to. gog returns only 10 events by default, so a wide date range is USUALLY INCOMPLETE: raise max, or page with pageToken until the response carries no nextPageToken. A response carrying "truncated": true is an incomplete view \u2014 never conclude an event does not exist from one.',
|
|
@@ -32052,9 +32232,10 @@ function registerCalendarTools(server) {
|
|
|
32052
32232
|
allDay: external_exports.boolean().optional().describe("All-day event (use date-only in from/to)"),
|
|
32053
32233
|
timezone: external_exports.string().optional().describe("IANA timezone metadata applied to from/to (e.g. America/New_York). Sets both start and end timezone unless start/end timezone are overridden."),
|
|
32054
32234
|
withZoom: external_exports.boolean().optional().describe("Create a Zoom video conference for this event (requires Zoom S2S OAuth setup)"),
|
|
32235
|
+
...reminderParams,
|
|
32055
32236
|
account: accountParam
|
|
32056
32237
|
}
|
|
32057
|
-
}, async ({ calendarId, summary, from, to, description, location, attendees, allDay, timezone, withZoom, account }) => {
|
|
32238
|
+
}, async ({ calendarId, summary, from, to, description, location, attendees, allDay, timezone, withZoom, reminders, noReminders, account }) => {
|
|
32058
32239
|
const args = ["calendar", "create", calendarId, `--summary=${summary}`, `--from=${from}`, `--to=${to}`];
|
|
32059
32240
|
if (description) args.push(`--description=${description}`);
|
|
32060
32241
|
if (location) args.push(`--location=${location}`);
|
|
@@ -32062,6 +32243,7 @@ function registerCalendarTools(server) {
|
|
|
32062
32243
|
if (allDay) args.push("--all-day");
|
|
32063
32244
|
if (timezone) args.push(`--timezone=${timezone}`);
|
|
32064
32245
|
if (withZoom) args.push("--with-zoom");
|
|
32246
|
+
pushReminderFlags(args, { reminders, noReminders });
|
|
32065
32247
|
return runOrDiagnose(args, { account });
|
|
32066
32248
|
});
|
|
32067
32249
|
server.registerTool("gog_calendar_update", {
|
|
@@ -32082,9 +32264,10 @@ function registerCalendarTools(server) {
|
|
|
32082
32264
|
regenerateZoom: external_exports.boolean().optional().describe("Replace the event's existing Zoom video conference"),
|
|
32083
32265
|
removeZoom: external_exports.boolean().optional().describe("Remove the event's Zoom video conference"),
|
|
32084
32266
|
removeMeet: external_exports.boolean().optional().describe("Remove the event's Google Meet video conference (clears conference data only)"),
|
|
32267
|
+
...reminderParams,
|
|
32085
32268
|
account: accountParam
|
|
32086
32269
|
}
|
|
32087
|
-
}, async ({ calendarId, eventId, summary, from, to, description, location, attendees, addAttendees, attachments, withZoom, regenerateZoom, removeZoom, removeMeet, account }) => {
|
|
32270
|
+
}, async ({ calendarId, eventId, summary, from, to, description, location, attendees, addAttendees, attachments, withZoom, regenerateZoom, removeZoom, removeMeet, reminders, noReminders, account }) => {
|
|
32088
32271
|
const args = ["calendar", "update", calendarId, eventId];
|
|
32089
32272
|
if (summary !== void 0) args.push(`--summary=${summary}`);
|
|
32090
32273
|
if (from !== void 0) args.push(`--from=${from}`);
|
|
@@ -32098,6 +32281,7 @@ function registerCalendarTools(server) {
|
|
|
32098
32281
|
if (regenerateZoom) args.push("--regenerate-zoom");
|
|
32099
32282
|
if (removeZoom) args.push("--remove-zoom");
|
|
32100
32283
|
if (removeMeet) args.push("--remove-meet");
|
|
32284
|
+
pushReminderFlags(args, { reminders, noReminders });
|
|
32101
32285
|
return runOrDiagnose(args, { account });
|
|
32102
32286
|
});
|
|
32103
32287
|
server.registerTool("gog_calendar_delete", {
|
|
@@ -32129,6 +32313,255 @@ function registerCalendarTools(server) {
|
|
|
32129
32313
|
registerRunTool(server, { service: "calendar", examples: '"calendars", "freebusy"' });
|
|
32130
32314
|
}
|
|
32131
32315
|
|
|
32316
|
+
// src/attachments.ts
|
|
32317
|
+
var MAX_INLINE_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
32318
|
+
var RUNNER_MAX_BODY_BYTES = 32 * 1024 * 1024;
|
|
32319
|
+
var RUNNER_BODY_JSON_RESERVE_BYTES = 256 * 1024;
|
|
32320
|
+
var MAX_REQUEST_PAYLOAD_WIRE_BYTES = RUNNER_MAX_BODY_BYTES - RUNNER_BODY_JSON_RESERVE_BYTES;
|
|
32321
|
+
var MAX_INLINE_ATTACHMENT_TOTAL_BYTES = Math.floor(MAX_REQUEST_PAYLOAD_WIRE_BYTES * 3 / 4);
|
|
32322
|
+
function wireBytesOf(arg) {
|
|
32323
|
+
if (typeof arg === "string") return Buffer.byteLength(arg, "utf8");
|
|
32324
|
+
return arg.encoding === "base64" ? arg.contents.length : Buffer.byteLength(arg.contents, "utf8");
|
|
32325
|
+
}
|
|
32326
|
+
var formatMiB = (bytes) => `${Math.floor(bytes / (1024 * 1024))} MiB`;
|
|
32327
|
+
var INLINE_ATTACHMENT_LIMITS_TEXT = `up to ${formatMiB(MAX_INLINE_ATTACHMENT_BYTES)} per file and ${formatMiB(MAX_INLINE_ATTACHMENT_TOTAL_BYTES)} in total`;
|
|
32328
|
+
var inlineAttachmentSchema = external_exports.object({
|
|
32329
|
+
filename: external_exports.string().min(1).describe(
|
|
32330
|
+
`Filename the recipient will see, e.g. "pendant-layouts.png". gog infers the attachment's MIME type from this extension, so give it the right one \u2014 a .png sent as "layouts" arrives as an untyped blob. Must be a single filename, not a path.`
|
|
32331
|
+
),
|
|
32332
|
+
contentBase64: external_exports.string().min(1).describe(
|
|
32333
|
+
"The file's bytes, base64-encoded (standard alphabet, with padding). This is the whole point of this parameter: the bytes travel with the request, so nothing needs to exist on the gog server's filesystem."
|
|
32334
|
+
)
|
|
32335
|
+
});
|
|
32336
|
+
var attachInlineParam = external_exports.array(inlineAttachmentSchema).optional().describe(
|
|
32337
|
+
`Attachments supplied as BYTES rather than as server-side paths \u2014 use this whenever you hold a file and the gog server does not, which is always the case on the hosted connector and on any remote deployment. Each entry is {filename, contentBase64} (${INLINE_ATTACHMENT_LIMITS_TEXT}). Can be combined with \`attach\`: the two name disjoint files (paths read on the server vs. bytes sent with the call), and both end up as ordinary attachments on the message.`
|
|
32338
|
+
);
|
|
32339
|
+
function validateFilename(filename, where) {
|
|
32340
|
+
if (/[/\\]/.test(filename)) {
|
|
32341
|
+
throw new Error(
|
|
32342
|
+
`${where}: filename ${JSON.stringify(filename)} must be a bare filename, not a path. Pass just the name the recipient should see, e.g. "report.pdf".`
|
|
32343
|
+
);
|
|
32344
|
+
}
|
|
32345
|
+
if (/[\x00-\x1f]/.test(filename) || /^\.+$/.test(filename) || filename.length > 200) {
|
|
32346
|
+
throw new Error(
|
|
32347
|
+
`${where}: filename ${JSON.stringify(filename)} is not a usable filename (no control characters, not "."/"..", 200 characters max).`
|
|
32348
|
+
);
|
|
32349
|
+
}
|
|
32350
|
+
}
|
|
32351
|
+
function decodedLength(contentBase64) {
|
|
32352
|
+
const buf = Buffer.from(contentBase64, "base64");
|
|
32353
|
+
return buf.toString("base64") === contentBase64 ? buf.length : null;
|
|
32354
|
+
}
|
|
32355
|
+
function inlineFileArg(flag, attachment, opts = {}) {
|
|
32356
|
+
const { filename, contentBase64 } = attachment;
|
|
32357
|
+
const where = opts.where ?? `attachInline entry ${JSON.stringify(filename)}`;
|
|
32358
|
+
validateFilename(filename, where);
|
|
32359
|
+
const bytes = decodedLength(contentBase64);
|
|
32360
|
+
if (bytes === null) {
|
|
32361
|
+
throw new Error(
|
|
32362
|
+
`${where}: contents are not valid base64. Send the standard alphabet with padding and no line breaks \u2014 the value must survive a decode/re-encode round trip unchanged.`
|
|
32363
|
+
);
|
|
32364
|
+
}
|
|
32365
|
+
if (bytes > MAX_INLINE_ATTACHMENT_BYTES) {
|
|
32366
|
+
throw new Error(
|
|
32367
|
+
`${where}: ${bytes} bytes exceeds the ${MAX_INLINE_ATTACHMENT_BYTES}-byte (${formatMiB(MAX_INLINE_ATTACHMENT_BYTES)}) per-file limit for inline content. Upload it to Drive and link to it instead, or send it from a local (stdio) deployment using a real server-side path.`
|
|
32368
|
+
);
|
|
32369
|
+
}
|
|
32370
|
+
const arg = { kind: "file", flag, contents: contentBase64, encoding: "base64", filename };
|
|
32371
|
+
if (opts.positional) arg.positional = true;
|
|
32372
|
+
return { arg, bytes };
|
|
32373
|
+
}
|
|
32374
|
+
function inlineAttachmentArgs(flag, attachments, siblingArgs = []) {
|
|
32375
|
+
if (!attachments?.length) return [];
|
|
32376
|
+
const args = [];
|
|
32377
|
+
const siblingWire = siblingArgs.reduce((sum, arg) => sum + wireBytesOf(arg), 0);
|
|
32378
|
+
let attachmentWire = 0;
|
|
32379
|
+
let decodedTotal = 0;
|
|
32380
|
+
for (const attachment of attachments) {
|
|
32381
|
+
const { arg, bytes } = inlineFileArg(flag, attachment);
|
|
32382
|
+
attachmentWire += arg.contents.length;
|
|
32383
|
+
decodedTotal += bytes;
|
|
32384
|
+
if (siblingWire + attachmentWire > MAX_REQUEST_PAYLOAD_WIRE_BYTES) {
|
|
32385
|
+
const blame = attachmentWire <= MAX_REQUEST_PAYLOAD_WIRE_BYTES ? ` These attachments would fit on their own; the rest of the message (its body, mostly) spends ${siblingWire} bytes of the same budget.` : "";
|
|
32386
|
+
throw new Error(
|
|
32387
|
+
`This message is too large to send: ${decodedTotal} bytes of attachments (${attachmentWire} bytes once base64-encoded for transit) exceed the ${MAX_REQUEST_PAYLOAD_WIRE_BYTES}-byte request limit.${blame} The ceiling for attachments alone is ${MAX_INLINE_ATTACHMENT_TOTAL_BYTES} bytes (${formatMiB(MAX_INLINE_ATTACHMENT_TOTAL_BYTES)}); a long body lowers it. Send fewer or smaller files per message, shorten the body, or upload the large files to Drive and link them.`
|
|
32388
|
+
);
|
|
32389
|
+
}
|
|
32390
|
+
args.push(arg);
|
|
32391
|
+
}
|
|
32392
|
+
return args;
|
|
32393
|
+
}
|
|
32394
|
+
|
|
32395
|
+
// src/tools/chat.ts
|
|
32396
|
+
function registerChatTools(server) {
|
|
32397
|
+
const workspaceOnlyNote = ' WORKSPACE ONLY: Google Chat has no API for consumer accounts, so this fails on an @gmail.com account with "chat requires a Google Workspace account". That is the ACCOUNT, not the token \u2014 re-authorizing or adding scopes will not help.';
|
|
32398
|
+
const spaceParam = external_exports.string().describe(
|
|
32399
|
+
'Space resource name, e.g. "spaces/AAAAsomeID" (from gog_chat_spaces_list, gog_chat_spaces_find or gog_chat_dm_space)'
|
|
32400
|
+
);
|
|
32401
|
+
const threadParam = external_exports.string().optional().describe(
|
|
32402
|
+
'Thread resource name, e.g. "spaces/AAAA/threads/CCCC" \u2014 reply inside that thread instead of starting a new one'
|
|
32403
|
+
);
|
|
32404
|
+
server.registerTool("gog_chat_spaces_list", {
|
|
32405
|
+
description: "List the Google Chat spaces the account belongs to \u2014 named rooms and DMs alike \u2014 with their resource names. Start here when you do not yet have a space name; gog_chat_spaces_find is faster when you know the room's title." + workspaceOnlyNote,
|
|
32406
|
+
annotations: { readOnlyHint: true },
|
|
32407
|
+
inputSchema: {
|
|
32408
|
+
...paginationParams,
|
|
32409
|
+
account: accountParam
|
|
32410
|
+
}
|
|
32411
|
+
}, async ({ max, pageToken, page, all, account }) => {
|
|
32412
|
+
const args = ["chat", "spaces", "list"];
|
|
32413
|
+
pushPaginationFlags(args, { max, pageToken, page, all });
|
|
32414
|
+
return runOrDiagnose(args, { account });
|
|
32415
|
+
});
|
|
32416
|
+
server.registerTool("gog_chat_spaces_find", {
|
|
32417
|
+
description: 'Find spaces whose display name matches. Substring and case-insensitive by default, which is what you want when the user names a room approximately ("the launch room"); pass exact=true to require the whole title. DMs have no display name \u2014 use gog_chat_dm_space to reach a person.' + workspaceOnlyNote,
|
|
32418
|
+
annotations: { readOnlyHint: true },
|
|
32419
|
+
inputSchema: {
|
|
32420
|
+
displayName: external_exports.string().describe("Space display name, or part of one"),
|
|
32421
|
+
exact: external_exports.boolean().optional().describe("Require an exact (still case-insensitive) match on the whole display name"),
|
|
32422
|
+
max: external_exports.number().int().optional().describe("Max results per page"),
|
|
32423
|
+
account: accountParam
|
|
32424
|
+
}
|
|
32425
|
+
}, async ({ displayName, exact, max, account }) => {
|
|
32426
|
+
const args = ["chat", "spaces", "find", displayName];
|
|
32427
|
+
if (exact) args.push("--exact");
|
|
32428
|
+
if (max !== void 0) args.push(`--max=${max}`);
|
|
32429
|
+
return runOrDiagnose(args, { account });
|
|
32430
|
+
});
|
|
32431
|
+
server.registerTool("gog_chat_spaces_create", {
|
|
32432
|
+
description: "Create a named Chat space, optionally seeding its membership. Members are added immediately and are notified \u2014 this is visible to other people the moment it runs, so confirm the member list before calling it." + workspaceOnlyNote,
|
|
32433
|
+
inputSchema: {
|
|
32434
|
+
displayName: external_exports.string().describe("Display name for the new space"),
|
|
32435
|
+
members: external_exports.array(external_exports.string()).optional().describe('Initial members, as email addresses or "users/..." resource names'),
|
|
32436
|
+
account: accountParam
|
|
32437
|
+
}
|
|
32438
|
+
}, async ({ displayName, members, account }) => {
|
|
32439
|
+
const args = ["chat", "spaces", "create", displayName];
|
|
32440
|
+
if (members) for (const member of members) args.push(`--member=${member}`);
|
|
32441
|
+
return runOrDiagnose(args, { account });
|
|
32442
|
+
});
|
|
32443
|
+
server.registerTool("gog_chat_threads_list", {
|
|
32444
|
+
description: "List the threads in a space, so a reply can be targeted at an existing conversation rather than starting a new one. Pass a thread name from here as `thread` to gog_chat_messages_send." + workspaceOnlyNote,
|
|
32445
|
+
annotations: { readOnlyHint: true },
|
|
32446
|
+
inputSchema: {
|
|
32447
|
+
space: spaceParam,
|
|
32448
|
+
...paginationParams,
|
|
32449
|
+
account: accountParam
|
|
32450
|
+
}
|
|
32451
|
+
}, async ({ space, max, pageToken, page, all, account }) => {
|
|
32452
|
+
const args = ["chat", "threads", "list", space];
|
|
32453
|
+
pushPaginationFlags(args, { max, pageToken, page, all });
|
|
32454
|
+
return runOrDiagnose(args, { account });
|
|
32455
|
+
});
|
|
32456
|
+
server.registerTool("gog_chat_messages_list", {
|
|
32457
|
+
description: `Read messages in a space. The JSON carries each message's @-mentions and a summary of its emoji reactions (gog >= 0.38.0) alongside the text, so "who was tagged" and "did anyone react" are answerable without extra calls. unread=true returns only what arrived after the account last read the space \u2014 the cheap way to answer "what did I miss". Newest-first needs an explicit order="createTime desc"; Chat's own default is oldest-first.` + workspaceOnlyNote,
|
|
32458
|
+
annotations: { readOnlyHint: true },
|
|
32459
|
+
inputSchema: {
|
|
32460
|
+
space: spaceParam,
|
|
32461
|
+
thread: threadParam,
|
|
32462
|
+
unread: external_exports.boolean().optional().describe("Only messages posted after the account last read this space"),
|
|
32463
|
+
order: external_exports.enum(["createTime asc", "createTime desc", "lastUpdateTime asc", "lastUpdateTime desc"]).optional().describe('Sort order (Chat default: "createTime asc", i.e. OLDEST first \u2014 ask for "createTime desc" when you want the latest messages)'),
|
|
32464
|
+
...paginationParams,
|
|
32465
|
+
account: accountParam
|
|
32466
|
+
}
|
|
32467
|
+
}, async ({ space, thread, unread, order, max, pageToken, page, all, account }) => {
|
|
32468
|
+
const args = ["chat", "messages", "list", space];
|
|
32469
|
+
if (thread) args.push(`--thread=${thread}`);
|
|
32470
|
+
if (unread) args.push("--unread");
|
|
32471
|
+
if (order) args.push(`--order=${order}`);
|
|
32472
|
+
pushPaginationFlags(args, { max, pageToken, page, all });
|
|
32473
|
+
return runOrDiagnose(args, { account });
|
|
32474
|
+
});
|
|
32475
|
+
server.registerTool("gog_chat_messages_send", {
|
|
32476
|
+
description: "Post a message to a Chat space. THIS IS IMMEDIATELY VISIBLE TO EVERYONE IN THE SPACE and cannot be unsent through this tool, so treat it like sending mail, not like saving a draft. Pass `thread` to reply inside an existing conversation (from gog_chat_threads_list or a message's thread field); omit it to start a new one. Text supports Chat's markdown-ish formatting (*bold*, _italic_, `code`)." + workspaceOnlyNote,
|
|
32477
|
+
inputSchema: {
|
|
32478
|
+
space: spaceParam,
|
|
32479
|
+
text: external_exports.string().optional().describe("Message text. Optional only when an attachment is supplied."),
|
|
32480
|
+
thread: threadParam,
|
|
32481
|
+
attach: external_exports.array(external_exports.string()).optional().describe(
|
|
32482
|
+
"Attachment file paths, read WHERE GOG RUNS. On a hosted or remote deployment that is not your machine \u2014 use attachInline there instead."
|
|
32483
|
+
),
|
|
32484
|
+
attachInline: attachInlineParam,
|
|
32485
|
+
account: accountParam
|
|
32486
|
+
}
|
|
32487
|
+
}, async ({ space, text, thread, attach, attachInline, account }) => {
|
|
32488
|
+
if (text === void 0 && !attach?.length && !attachInline?.length) {
|
|
32489
|
+
throw new Error("A Chat message needs text, an attachment, or both.");
|
|
32490
|
+
}
|
|
32491
|
+
const args = ["chat", "messages", "send", space];
|
|
32492
|
+
if (text !== void 0) args.push(`--text=${text}`);
|
|
32493
|
+
if (thread) args.push(`--thread=${thread}`);
|
|
32494
|
+
if (attach) for (const path of attach) args.push(`--attach=${path}`);
|
|
32495
|
+
args.push(...inlineAttachmentArgs("attach", attachInline, args));
|
|
32496
|
+
return runOrDiagnose(args, { account });
|
|
32497
|
+
});
|
|
32498
|
+
server.registerTool("gog_chat_dm_send", {
|
|
32499
|
+
description: "Send a direct message to one person by email address, creating the DM space if this is the first message. Delivered immediately and cannot be unsent through this tool. For a room rather than a person, use gog_chat_messages_send." + workspaceOnlyNote,
|
|
32500
|
+
inputSchema: {
|
|
32501
|
+
email: external_exports.string().describe("Recipient email address"),
|
|
32502
|
+
text: external_exports.string().describe("Message text"),
|
|
32503
|
+
thread: threadParam,
|
|
32504
|
+
account: accountParam
|
|
32505
|
+
}
|
|
32506
|
+
}, async ({ email: email3, text, thread, account }) => {
|
|
32507
|
+
const args = ["chat", "dm", "send", email3, `--text=${text}`];
|
|
32508
|
+
if (thread) args.push(`--thread=${thread}`);
|
|
32509
|
+
return runOrDiagnose(args, { account });
|
|
32510
|
+
});
|
|
32511
|
+
server.registerTool("gog_chat_dm_space", {
|
|
32512
|
+
description: 'Resolve the DM space for an email address \u2014 the bridge from a person to the "spaces/..." name the message tools want. Creates the space if none exists yet, which is silent: it does not message the person.' + workspaceOnlyNote,
|
|
32513
|
+
inputSchema: {
|
|
32514
|
+
email: external_exports.string().describe("The other person's email address"),
|
|
32515
|
+
account: accountParam
|
|
32516
|
+
}
|
|
32517
|
+
}, async ({ email: email3, account }) => {
|
|
32518
|
+
return runOrDiagnose(["chat", "dm", "space", email3], { account });
|
|
32519
|
+
});
|
|
32520
|
+
server.registerTool("gog_chat_reactions_list", {
|
|
32521
|
+
description: "List the emoji reactions on one message, with who reacted. gog_chat_messages_list already returns a reaction SUMMARY per message; come here when you need the individual reactors, or the reaction resource names that gog_chat_reactions_delete takes." + workspaceOnlyNote,
|
|
32522
|
+
annotations: { readOnlyHint: true },
|
|
32523
|
+
inputSchema: {
|
|
32524
|
+
message: external_exports.string().describe('Message resource name ("spaces/AAAA/messages/BBBB"), or a bare message ID together with `space`'),
|
|
32525
|
+
space: external_exports.string().optional().describe("Space resource name \u2014 required only when `message` is a bare ID"),
|
|
32526
|
+
...paginationParams,
|
|
32527
|
+
account: accountParam
|
|
32528
|
+
}
|
|
32529
|
+
}, async ({ message, space, max, pageToken, page, all, account }) => {
|
|
32530
|
+
const args = ["chat", "messages", "reactions", "list", message];
|
|
32531
|
+
if (space) args.push(`--space=${space}`);
|
|
32532
|
+
pushPaginationFlags(args, { max, pageToken, page, all });
|
|
32533
|
+
return runOrDiagnose(args, { account });
|
|
32534
|
+
});
|
|
32535
|
+
server.registerTool("gog_chat_reactions_create", {
|
|
32536
|
+
description: 'React to a message with an emoji. Visible to the space immediately. Pass the emoji itself ("\u{1F44D}"), not a :shortcode:.' + workspaceOnlyNote,
|
|
32537
|
+
inputSchema: {
|
|
32538
|
+
message: external_exports.string().describe('Message resource name ("spaces/AAAA/messages/BBBB"), or a bare message ID together with `space`'),
|
|
32539
|
+
emoji: external_exports.string().describe('The emoji character to react with, e.g. "\u{1F44D}"'),
|
|
32540
|
+
space: external_exports.string().optional().describe("Space resource name \u2014 required only when `message` is a bare ID"),
|
|
32541
|
+
account: accountParam
|
|
32542
|
+
}
|
|
32543
|
+
}, async ({ message, emoji: emoji3, space, account }) => {
|
|
32544
|
+
const args = ["chat", "messages", "reactions", "create", message, emoji3];
|
|
32545
|
+
if (space) args.push(`--space=${space}`);
|
|
32546
|
+
return runOrDiagnose(args, { account });
|
|
32547
|
+
});
|
|
32548
|
+
server.registerTool("gog_chat_reactions_delete", {
|
|
32549
|
+
description: `Remove one emoji reaction. Takes the REACTION's own resource name ("spaces/.../messages/.../reactions/..."), not the message's and not the emoji \u2014 get it from gog_chat_reactions_list. An account can only remove its own reaction.` + workspaceOnlyNote,
|
|
32550
|
+
annotations: { destructiveHint: true },
|
|
32551
|
+
inputSchema: {
|
|
32552
|
+
reaction: external_exports.string().describe('Reaction resource name, e.g. "spaces/AAAA/messages/BBBB/reactions/CCCC"'),
|
|
32553
|
+
account: accountParam
|
|
32554
|
+
}
|
|
32555
|
+
}, async ({ reaction, account }) => {
|
|
32556
|
+
return runOrDiagnose(["chat", "messages", "reactions", "delete", reaction], { account });
|
|
32557
|
+
});
|
|
32558
|
+
registerRunTool(server, {
|
|
32559
|
+
service: "chat",
|
|
32560
|
+
examples: '"spaces", "messages", "dm"',
|
|
32561
|
+
note: "Google Chat has no API for consumer accounts: every chat subcommand fails on an @gmail.com account regardless of scopes."
|
|
32562
|
+
});
|
|
32563
|
+
}
|
|
32564
|
+
|
|
32132
32565
|
// src/tools/classroom.ts
|
|
32133
32566
|
function registerClassroomTools(server) {
|
|
32134
32567
|
server.registerTool("gog_classroom_courses_list", {
|
|
@@ -32944,6 +33377,7 @@ async function fetchGmailPages(runPage, itemsKey, maxPages, startToken) {
|
|
|
32944
33377
|
const merged = [];
|
|
32945
33378
|
let base;
|
|
32946
33379
|
let token = startToken;
|
|
33380
|
+
const fetched = new Set(startToken === void 0 ? [] : [startToken]);
|
|
32947
33381
|
for (let pages = 0; pages < maxPages; pages++) {
|
|
32948
33382
|
const result = await runPage(token);
|
|
32949
33383
|
const parsed = parsePage(result, itemsKey);
|
|
@@ -32952,8 +33386,17 @@ async function fetchGmailPages(runPage, itemsKey, maxPages, startToken) {
|
|
|
32952
33386
|
}
|
|
32953
33387
|
base = parsed;
|
|
32954
33388
|
merged.push(...parsed[itemsKey]);
|
|
32955
|
-
|
|
32956
|
-
if (
|
|
33389
|
+
const next = typeof parsed.nextPageToken === "string" && parsed.nextPageToken !== "" ? parsed.nextPageToken : void 0;
|
|
33390
|
+
if (next === void 0) {
|
|
33391
|
+
token = void 0;
|
|
33392
|
+
break;
|
|
33393
|
+
}
|
|
33394
|
+
if (fetched.has(next)) {
|
|
33395
|
+
token = next;
|
|
33396
|
+
break;
|
|
33397
|
+
}
|
|
33398
|
+
fetched.add(next);
|
|
33399
|
+
token = next;
|
|
32957
33400
|
}
|
|
32958
33401
|
return finish(base, itemsKey, merged, token);
|
|
32959
33402
|
}
|
|
@@ -32977,86 +33420,46 @@ function finish(base, itemsKey, merged, token) {
|
|
|
32977
33420
|
return rawTextResult(JSON.stringify(out));
|
|
32978
33421
|
}
|
|
32979
33422
|
|
|
32980
|
-
// src/attachments.ts
|
|
32981
|
-
var MAX_INLINE_ATTACHMENT_BYTES = 8 * 1024 * 1024;
|
|
32982
|
-
var RUNNER_MAX_BODY_BYTES = 32 * 1024 * 1024;
|
|
32983
|
-
var RUNNER_BODY_JSON_RESERVE_BYTES = 256 * 1024;
|
|
32984
|
-
var MAX_REQUEST_PAYLOAD_WIRE_BYTES = RUNNER_MAX_BODY_BYTES - RUNNER_BODY_JSON_RESERVE_BYTES;
|
|
32985
|
-
var MAX_INLINE_ATTACHMENT_TOTAL_BYTES = Math.floor(MAX_REQUEST_PAYLOAD_WIRE_BYTES * 3 / 4);
|
|
32986
|
-
function wireBytesOf(arg) {
|
|
32987
|
-
if (typeof arg === "string") return Buffer.byteLength(arg, "utf8");
|
|
32988
|
-
return arg.encoding === "base64" ? arg.contents.length : Buffer.byteLength(arg.contents, "utf8");
|
|
32989
|
-
}
|
|
32990
|
-
var formatMiB = (bytes) => `${Math.floor(bytes / (1024 * 1024))} MiB`;
|
|
32991
|
-
var INLINE_ATTACHMENT_LIMITS_TEXT = `up to ${formatMiB(MAX_INLINE_ATTACHMENT_BYTES)} per file and ${formatMiB(MAX_INLINE_ATTACHMENT_TOTAL_BYTES)} in total`;
|
|
32992
|
-
var inlineAttachmentSchema = external_exports.object({
|
|
32993
|
-
filename: external_exports.string().min(1).describe(
|
|
32994
|
-
`Filename the recipient will see, e.g. "pendant-layouts.png". gog infers the attachment's MIME type from this extension, so give it the right one \u2014 a .png sent as "layouts" arrives as an untyped blob. Must be a single filename, not a path.`
|
|
32995
|
-
),
|
|
32996
|
-
contentBase64: external_exports.string().min(1).describe(
|
|
32997
|
-
"The file's bytes, base64-encoded (standard alphabet, with padding). This is the whole point of this parameter: the bytes travel with the request, so nothing needs to exist on the gog server's filesystem."
|
|
32998
|
-
)
|
|
32999
|
-
});
|
|
33000
|
-
var attachInlineParam = external_exports.array(inlineAttachmentSchema).optional().describe(
|
|
33001
|
-
`Attachments supplied as BYTES rather than as server-side paths \u2014 use this whenever you hold a file and the gog server does not, which is always the case on the hosted connector and on any remote deployment. Each entry is {filename, contentBase64} (${INLINE_ATTACHMENT_LIMITS_TEXT}). Can be combined with \`attach\`: the two name disjoint files (paths read on the server vs. bytes sent with the call), and both end up as ordinary attachments on the message.`
|
|
33002
|
-
);
|
|
33003
|
-
function validateFilename(filename, where) {
|
|
33004
|
-
if (/[/\\]/.test(filename)) {
|
|
33005
|
-
throw new Error(
|
|
33006
|
-
`${where}: filename ${JSON.stringify(filename)} must be a bare filename, not a path. Pass just the name the recipient should see, e.g. "report.pdf".`
|
|
33007
|
-
);
|
|
33008
|
-
}
|
|
33009
|
-
if (/[\x00-\x1f]/.test(filename) || /^\.+$/.test(filename) || filename.length > 200) {
|
|
33010
|
-
throw new Error(
|
|
33011
|
-
`${where}: filename ${JSON.stringify(filename)} is not a usable filename (no control characters, not "."/"..", 200 characters max).`
|
|
33012
|
-
);
|
|
33013
|
-
}
|
|
33014
|
-
}
|
|
33015
|
-
function decodedLength(contentBase64) {
|
|
33016
|
-
const buf = Buffer.from(contentBase64, "base64");
|
|
33017
|
-
return buf.toString("base64") === contentBase64 ? buf.length : null;
|
|
33018
|
-
}
|
|
33019
|
-
function inlineFileArg(flag, attachment, opts = {}) {
|
|
33020
|
-
const { filename, contentBase64 } = attachment;
|
|
33021
|
-
const where = opts.where ?? `attachInline entry ${JSON.stringify(filename)}`;
|
|
33022
|
-
validateFilename(filename, where);
|
|
33023
|
-
const bytes = decodedLength(contentBase64);
|
|
33024
|
-
if (bytes === null) {
|
|
33025
|
-
throw new Error(
|
|
33026
|
-
`${where}: contents are not valid base64. Send the standard alphabet with padding and no line breaks \u2014 the value must survive a decode/re-encode round trip unchanged.`
|
|
33027
|
-
);
|
|
33028
|
-
}
|
|
33029
|
-
if (bytes > MAX_INLINE_ATTACHMENT_BYTES) {
|
|
33030
|
-
throw new Error(
|
|
33031
|
-
`${where}: ${bytes} bytes exceeds the ${MAX_INLINE_ATTACHMENT_BYTES}-byte (${formatMiB(MAX_INLINE_ATTACHMENT_BYTES)}) per-file limit for inline content. Upload it to Drive and link to it instead, or send it from a local (stdio) deployment using a real server-side path.`
|
|
33032
|
-
);
|
|
33033
|
-
}
|
|
33034
|
-
const arg = { kind: "file", flag, contents: contentBase64, encoding: "base64", filename };
|
|
33035
|
-
if (opts.positional) arg.positional = true;
|
|
33036
|
-
return { arg, bytes };
|
|
33037
|
-
}
|
|
33038
|
-
function inlineAttachmentArgs(flag, attachments, siblingArgs = []) {
|
|
33039
|
-
if (!attachments?.length) return [];
|
|
33040
|
-
const args = [];
|
|
33041
|
-
const siblingWire = siblingArgs.reduce((sum, arg) => sum + wireBytesOf(arg), 0);
|
|
33042
|
-
let attachmentWire = 0;
|
|
33043
|
-
let decodedTotal = 0;
|
|
33044
|
-
for (const attachment of attachments) {
|
|
33045
|
-
const { arg, bytes } = inlineFileArg(flag, attachment);
|
|
33046
|
-
attachmentWire += arg.contents.length;
|
|
33047
|
-
decodedTotal += bytes;
|
|
33048
|
-
if (siblingWire + attachmentWire > MAX_REQUEST_PAYLOAD_WIRE_BYTES) {
|
|
33049
|
-
const blame = attachmentWire <= MAX_REQUEST_PAYLOAD_WIRE_BYTES ? ` These attachments would fit on their own; the rest of the message (its body, mostly) spends ${siblingWire} bytes of the same budget.` : "";
|
|
33050
|
-
throw new Error(
|
|
33051
|
-
`This message is too large to send: ${decodedTotal} bytes of attachments (${attachmentWire} bytes once base64-encoded for transit) exceed the ${MAX_REQUEST_PAYLOAD_WIRE_BYTES}-byte request limit.${blame} The ceiling for attachments alone is ${MAX_INLINE_ATTACHMENT_TOTAL_BYTES} bytes (${formatMiB(MAX_INLINE_ATTACHMENT_TOTAL_BYTES)}); a long body lowers it. Send fewer or smaller files per message, shorten the body, or upload the large files to Drive and link them.`
|
|
33052
|
-
);
|
|
33053
|
-
}
|
|
33054
|
-
args.push(arg);
|
|
33055
|
-
}
|
|
33056
|
-
return args;
|
|
33057
|
-
}
|
|
33058
|
-
|
|
33059
33423
|
// src/tools/gmail.ts
|
|
33424
|
+
var replySchema = {
|
|
33425
|
+
messageId: external_exports.string().describe("Gmail message ID to reply to \u2014 the short hex `id` from gog_gmail_get / _search (or gog_gmail_messages_search, gogcli-mcp-gmail only). NOT the threadId, NOT the RFC822 `<\u2026@host>` Message-Id header."),
|
|
33426
|
+
body: external_exports.string().optional().describe("Reply body (plain text; required unless bodyHtml or bodyHtmlFile is set). Any size \u2014 a large body is written to a temp file on the gog server rather than inlined into the command line. Note gog strips trailing newlines from a file-delivered body."),
|
|
33427
|
+
bodyHtml: external_exports.string().optional().describe("Reply body (HTML; optional). Pass the HTML itself at any size \u2014 a large body is written to a temp file on the gog server rather than inlined into the command line. Mutually exclusive with bodyHtmlFile."),
|
|
33428
|
+
bodyHtmlFile: external_exports.string().optional().describe(`Path to an HTML file that ALREADY EXISTS on the gog server for the reply body. gog also accepts "-" for stdin, but this server never writes to gog's stdin, so "-" would hang until the call times out. Mutually exclusive with bodyHtml \u2014 supplying both is rejected. You rarely need this: bodyHtml handles large bodies on its own.`),
|
|
33429
|
+
to: external_exports.array(external_exports.string()).optional().describe("Add or move recipients to To (repeatable). Added on top of the recipients inherited from the original message."),
|
|
33430
|
+
cc: external_exports.array(external_exports.string()).optional().describe("Add or move recipients to Cc (repeatable)"),
|
|
33431
|
+
bcc: external_exports.array(external_exports.string()).optional().describe("Add or move recipients to Bcc (repeatable)"),
|
|
33432
|
+
remove: external_exports.array(external_exports.string()).optional().describe("Remove these recipients from all fields (repeatable) \u2014 e.g. to drop someone from a reply-all."),
|
|
33433
|
+
subject: external_exports.string().optional().describe('Override reply subject (default: "Re: <original>"). A changed subject starts a NEW Gmail thread.'),
|
|
33434
|
+
noQuote: external_exports.boolean().optional().describe("Do not include the original message quoted below the reply (default: the original is quoted)"),
|
|
33435
|
+
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on the hosted connector or any GOG_RUNNER_URL backend these paths do not exist and the call fails with "no such file or directory" \u2014 use attachInline there. Read on the server, base64-encoded with a MIME type inferred from the extension.`),
|
|
33436
|
+
attachInline: attachInlineParam,
|
|
33437
|
+
from: external_exports.string().optional().describe("Send from this email address (must be a verified send-as alias)"),
|
|
33438
|
+
autoFromAddressedAlias: external_exports.boolean().optional().describe("When from is omitted, send from the verified send-as alias the original message was addressed TO, instead of the account's primary address \u2014 so a reply to mail sent to an alias goes back out from that alias. Ignored when from is set."),
|
|
33439
|
+
signature: external_exports.boolean().optional().describe("Append the Gmail signature from the active send-as address"),
|
|
33440
|
+
signatureFrom: external_exports.string().optional().describe("Append the Gmail signature from this send-as email address"),
|
|
33441
|
+
signatureFile: external_exports.string().optional().describe("Append a local signature file (plain text or HTML), read on the gog server"),
|
|
33442
|
+
account: accountParam
|
|
33443
|
+
};
|
|
33444
|
+
function appendReplyFlags(args, f) {
|
|
33445
|
+
assertNotBoth("bodyHtml", "bodyHtmlFile", f.bodyHtml, f.bodyHtmlFile);
|
|
33446
|
+
if (f.body) args.push(payloadArg("body", "body-file", f.body));
|
|
33447
|
+
if (f.bodyHtml) args.push(payloadArg("body-html", "body-html-file", f.bodyHtml, "html"));
|
|
33448
|
+
else if (f.bodyHtmlFile) args.push(`--body-html-file=${f.bodyHtmlFile}`);
|
|
33449
|
+
if (f.to) for (const r of f.to) args.push(`--to=${r}`);
|
|
33450
|
+
if (f.cc) for (const r of f.cc) args.push(`--cc=${r}`);
|
|
33451
|
+
if (f.bcc) for (const r of f.bcc) args.push(`--bcc=${r}`);
|
|
33452
|
+
if (f.remove) for (const r of f.remove) args.push(`--remove=${r}`);
|
|
33453
|
+
if (f.subject) args.push(`--subject=${f.subject}`);
|
|
33454
|
+
if (f.noQuote) args.push("--no-quote");
|
|
33455
|
+
if (f.attach) for (const p of f.attach) args.push(`--attach=${p}`);
|
|
33456
|
+
args.push(...inlineAttachmentArgs("attach", f.attachInline, args));
|
|
33457
|
+
if (f.from) args.push(`--from=${f.from}`);
|
|
33458
|
+
if (f.signature) args.push("--signature");
|
|
33459
|
+
if (f.signatureFrom) args.push(`--signature-from=${f.signatureFrom}`);
|
|
33460
|
+
if (f.signatureFile) args.push(`--signature-file=${f.signatureFile}`);
|
|
33461
|
+
args.push(f.autoFromAddressedAlias ? "--auto-from-addressed-alias" : "--auto-from-addressed-alias=false");
|
|
33462
|
+
}
|
|
33060
33463
|
function registerGmailTools(server) {
|
|
33061
33464
|
server.registerTool("gog_gmail_search", {
|
|
33062
33465
|
description: 'Search Gmail threads using Gmail query syntax (e.g. "from:alice subject:invoice is:unread"). The query is passed verbatim to Gmail; a bare name token (from:alison) matches per Gmail\'s own heuristics, a full address (from:alison@example.com) is exact. To match a contact across several addresses, OR them: from:(a@x.com OR b@y.com). Results are ALWAYS newest-first by Gmail\'s internalDate \u2014 the wrapper sorts them, so the first result is the most recent match and a recent message can never be buried below older ones. IMPORTANT \u2014 a response carrying "truncated": true is an INCOMPLETE view of the matches: NEVER report that a message does not exist, or that there is no such mail, on the strength of one. Page through it (pass nextPageToken back as `pageToken`), set maxPages to walk several pages in one call, or narrow the query, and only then draw a conclusion. If you already know the thread, do not search for it at all \u2014 read it directly with gog_gmail_thread_get, which returns the whole thread and cannot be truncated or mis-ranked.',
|
|
@@ -33109,7 +33512,7 @@ function registerGmailTools(server) {
|
|
|
33109
33512
|
return runOrDiagnose(args, { account });
|
|
33110
33513
|
});
|
|
33111
33514
|
server.registerTool("gog_gmail_send", {
|
|
33112
|
-
description: 'Send an email. Two ways to attach a file: `attach` takes paths READ ON THE GOG SERVER, and `attachInline` takes the bytes themselves. Use attachInline unless you know the file exists on the same machine gog runs on \u2014 on the hosted connector and any remote deployment there is no shared filesystem, so no path you can name resolves there and `attach` will fail with "no such file or directory". When either is used, the JSON result echoes the attached filenames and byte sizes \u2014 check it to confirm the files were embedded.',
|
|
33515
|
+
description: 'Send an email. Two ways to attach a file: `attach` takes paths READ ON THE GOG SERVER, and `attachInline` takes the bytes themselves. Use attachInline unless you know the file exists on the same machine gog runs on \u2014 on the hosted connector and any remote deployment there is no shared filesystem, so no path you can name resolves there and `attach` will fail with "no such file or directory". When either is used, the JSON result echoes the attached filenames and byte sizes \u2014 check it to confirm the files were embedded. NOT the tool for answering a message: replyToMessageId only files this in the right thread \u2014 the subject, recipients and body are entirely yours, and the original is not quoted unless you set quote. Use gog_gmail_reply / gog_gmail_reply_all instead, which inherit all three.',
|
|
33113
33516
|
annotations: { destructiveHint: true },
|
|
33114
33517
|
inputSchema: {
|
|
33115
33518
|
to: external_exports.string().describe("Recipient(s), comma-separated"),
|
|
@@ -33117,23 +33520,43 @@ function registerGmailTools(server) {
|
|
|
33117
33520
|
body: external_exports.string().describe("Email body (plain text). Any size \u2014 a large body is written to a temp file on the gog server rather than inlined into the command line. Note gog strips trailing newlines from a file-delivered body."),
|
|
33118
33521
|
cc: external_exports.string().optional().describe("CC recipients, comma-separated"),
|
|
33119
33522
|
bcc: external_exports.string().optional().describe("BCC recipients, comma-separated"),
|
|
33120
|
-
replyToMessageId: external_exports.string().optional().describe(
|
|
33121
|
-
threadId: external_exports.string().optional().describe("Thread ID to
|
|
33523
|
+
replyToMessageId: external_exports.string().optional().describe('Message ID to thread this message against \u2014 sets In-Reply-To/References only. It does NOT quote the original (pass quote for that), inherit its recipients, or prefix the subject with "Re:". For an actual reply use gog_gmail_reply.'),
|
|
33524
|
+
threadId: external_exports.string().optional().describe("Thread ID to thread this message within. Same caveat as replyToMessageId: threading only, no quote and no inherited subject or recipients."),
|
|
33525
|
+
quote: external_exports.boolean().optional().describe("Include the original message quoted below the body. Requires replyToMessageId or threadId. gog quotes by DEFAULT on gmail reply but never on gmail send, so without this a threaded send arrives with the original nowhere in it."),
|
|
33122
33526
|
attach: external_exports.array(external_exports.string()).optional().describe(`File paths to attach (repeatable), resolved ON THE GOG SERVER's filesystem \u2014 NOT this client's. Only usable when gog runs on the same machine you do (local stdio); on the hosted connector or any GOG_RUNNER_URL backend these paths do not exist and the call fails with "no such file or directory" \u2014 use attachInline there. Each file is read on the server, base64-encoded with a MIME type inferred from its extension, and added as a multipart attachment.`),
|
|
33123
33527
|
attachInline: attachInlineParam,
|
|
33124
33528
|
account: accountParam
|
|
33125
33529
|
}
|
|
33126
|
-
}, async ({ to, subject, body, cc, bcc, replyToMessageId, threadId, attach, attachInline, account }) => {
|
|
33530
|
+
}, async ({ to, subject, body, cc, bcc, replyToMessageId, threadId, quote, attach, attachInline, account }) => {
|
|
33127
33531
|
const args = ["gmail", "send", `--to=${to}`, `--subject=${subject}`, payloadArg("body", "body-file", body)];
|
|
33128
33532
|
if (cc) args.push(`--cc=${cc}`);
|
|
33129
33533
|
if (bcc) args.push(`--bcc=${bcc}`);
|
|
33130
33534
|
if (replyToMessageId) args.push(`--reply-to-message-id=${replyToMessageId}`);
|
|
33131
33535
|
if (threadId) args.push(`--thread-id=${threadId}`);
|
|
33536
|
+
if (quote) args.push("--quote");
|
|
33132
33537
|
if (attach) for (const path of attach) args.push(`--attach=${path}`);
|
|
33133
33538
|
const inline = inlineAttachmentArgs("attach", attachInline, args);
|
|
33134
33539
|
args.push(...inline);
|
|
33135
33540
|
return runOrDiagnose(args, { account });
|
|
33136
33541
|
});
|
|
33542
|
+
server.registerTool("gog_gmail_reply", {
|
|
33543
|
+
description: 'Reply to a Gmail message (goes to the original sender only). USE THIS, not gog_gmail_send, whenever you are answering a message: it threads off the original AND inherits its "Re:" subject and quotes its body below yours, which gog_gmail_send does not \u2014 a send with replyToMessageId lands in the right thread but reads as a brand-new message, with the original nowhere in it. To answer every participant use gog_gmail_reply_all. The gogcli-mcp-gmail package adds two more routes with the same composition: gog_gmail_autoreply to reply across every message matching a query, and gog_gmail_drafts_reply to stage this exact reply as a draft instead of sending it.',
|
|
33544
|
+
annotations: { destructiveHint: true },
|
|
33545
|
+
inputSchema: replySchema
|
|
33546
|
+
}, async ({ messageId, account, ...flags }) => {
|
|
33547
|
+
const args = ["gmail", "reply", messageId];
|
|
33548
|
+
appendReplyFlags(args, flags);
|
|
33549
|
+
return runOrDiagnose(args, { account });
|
|
33550
|
+
});
|
|
33551
|
+
server.registerTool("gog_gmail_reply_all", {
|
|
33552
|
+
description: 'Reply to all participants of a Gmail message (the sender plus every To/Cc recipient). Same inherited "Re:" subject and quoted original as gog_gmail_reply. Use the remove flag to drop specific recipients from the reply-all. To stage it as a draft rather than send it, use gog_gmail_drafts_reply_all (gogcli-mcp-gmail only).',
|
|
33553
|
+
annotations: { destructiveHint: true },
|
|
33554
|
+
inputSchema: replySchema
|
|
33555
|
+
}, async ({ messageId, account, ...flags }) => {
|
|
33556
|
+
const args = ["gmail", "reply-all", messageId];
|
|
33557
|
+
appendReplyFlags(args, flags);
|
|
33558
|
+
return runOrDiagnose(args, { account });
|
|
33559
|
+
});
|
|
33137
33560
|
registerRunTool(server, { service: "gmail", examples: '"archive", "mark-read", "labels"' });
|
|
33138
33561
|
}
|
|
33139
33562
|
|
|
@@ -33461,11 +33884,13 @@ function registerTasksTools(server) {
|
|
|
33461
33884
|
}
|
|
33462
33885
|
|
|
33463
33886
|
// src/server.ts
|
|
33464
|
-
var VERSION = true ? "2.
|
|
33887
|
+
var VERSION = true ? "2.27.0" : "0.0.0";
|
|
33465
33888
|
var BASE_TOOL_REGISTRARS = [
|
|
33466
33889
|
registerApiTools,
|
|
33890
|
+
registerAppScriptTools,
|
|
33467
33891
|
registerAuthTools,
|
|
33468
33892
|
registerCalendarTools,
|
|
33893
|
+
registerChatTools,
|
|
33469
33894
|
registerClassroomTools,
|
|
33470
33895
|
registerContactsTools,
|
|
33471
33896
|
registerDocsTools,
|