gogcli-mcp-docs 2.21.1 → 2.23.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 +1 -1
- package/SKILL.md +1 -1
- package/dist/index.js +129 -14
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/tools/docs-extra.ts +15 -6
- package/tests/tools/docs-extra.test.ts +108 -0
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "Extended Google Docs for Claude via gogcli — auth + full Docs and comments support",
|
|
10
|
-
"version": "2.
|
|
10
|
+
"version": "2.23.0"
|
|
11
11
|
},
|
|
12
12
|
"plugins": [
|
|
13
13
|
{
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"displayName": "gogcli (Docs)",
|
|
16
16
|
"source": "./",
|
|
17
17
|
"description": "Extended Google Docs for Claude via gogcli — auth + full Docs and comments support",
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.23.0",
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Chris Hall"
|
|
21
21
|
},
|
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ Plus 5 auth tools and 7 base Docs tools (info, cat, create, write, find-replace,
|
|
|
62
62
|
| `gog_docs_sed` | Stream-edit with sed-like regex expressions |
|
|
63
63
|
| `gog_docs_trash` | Move a doc to Drive trash |
|
|
64
64
|
| `gog_docs_update` | Update document content at a specific position |
|
|
65
|
-
| `gog_docs_comments_list` | List comments (open or resolved) |
|
|
65
|
+
| `gog_docs_comments_list` | List comments (open or resolved), optionally with each comment's tab and index ranges |
|
|
66
66
|
| `gog_docs_comments_get` | Get a comment with its replies |
|
|
67
67
|
| `gog_docs_comments_add` | Add a comment with optional quoted text |
|
|
68
68
|
| `gog_docs_comments_reply` | Reply to a comment |
|
package/SKILL.md
CHANGED
|
@@ -46,7 +46,7 @@ Extended Google Docs MCP server via [gogcli](https://github.com/openclaw/gogcli)
|
|
|
46
46
|
| `gog_docs_sed` | Stream-edit with sed-like regex |
|
|
47
47
|
| `gog_docs_trash` | Move a doc to Drive trash |
|
|
48
48
|
| `gog_docs_update` | Update content at a specific position |
|
|
49
|
-
| `gog_docs_comments_list` | List comments (open or resolved) |
|
|
49
|
+
| `gog_docs_comments_list` | List comments (open or resolved), optionally with each comment's tab and index ranges |
|
|
50
50
|
| `gog_docs_comments_get` | Get a comment with replies |
|
|
51
51
|
| `gog_docs_comments_add` | Add a comment with optional quoted text |
|
|
52
52
|
| `gog_docs_comments_reply` | Reply to a comment |
|
package/dist/index.js
CHANGED
|
@@ -31430,6 +31430,13 @@ var TIMESTAMP_KEYS = /* @__PURE__ */ new Set([
|
|
|
31430
31430
|
// Calendar event start/end
|
|
31431
31431
|
"internalDate",
|
|
31432
31432
|
// Gmail, epoch milliseconds (authoritative)
|
|
31433
|
+
// gog >= 0.35.0 Gmail message AND thread listings. Already offset-bearing
|
|
31434
|
+
// (RFC3339 from internalDate), so it needs no offset repair — it is
|
|
31435
|
+
// allowlisted purely to gain a Display sibling, and to be re-rendered in
|
|
31436
|
+
// DISPLAY_TZ like every other instant. Separately sourced from the sibling
|
|
31437
|
+
// `date`, which is a naive re-format of the sender's Date header; the two may
|
|
31438
|
+
// legitimately disagree. See docs/timestamps.md.
|
|
31439
|
+
"internalDateIso",
|
|
31433
31440
|
"modifiedTime",
|
|
31434
31441
|
// Drive
|
|
31435
31442
|
"createdTime",
|
|
@@ -31671,8 +31678,8 @@ function formatOneAccountHealth(a, now) {
|
|
|
31671
31678
|
const age = ageInDays(a.created_at, now);
|
|
31672
31679
|
const ageStr = age === null ? "" : ` Authorized ${age.toFixed(1)} day(s) ago.`;
|
|
31673
31680
|
if (a.valid === false) {
|
|
31674
|
-
const
|
|
31675
|
-
return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${
|
|
31681
|
+
const cause2 = INVALID_GRANT_PATTERN.test(a.error ?? "") ? 'refresh token expired or revoked \u2014 commonly the 7-day limit on OAuth consent screens still in "Testing" mode' : a.error?.trim() || "unknown error";
|
|
31682
|
+
return `\u2717 ${email3}: NEEDS RE-AUTH \u2014 ${cause2}.${ageStr} Re-authorize with gog_auth_add (browser) or gog_auth_add_url + gog_auth_add_complete (remote/headless).`;
|
|
31676
31683
|
}
|
|
31677
31684
|
if (a.valid === true) {
|
|
31678
31685
|
let line = `\u2713 ${email3}: token valid.${ageStr}`;
|
|
@@ -31714,7 +31721,7 @@ function registerAuthToolsWith(server, defaultServices) {
|
|
|
31714
31721
|
}
|
|
31715
31722
|
});
|
|
31716
31723
|
server.registerTool("gog_auth_status", {
|
|
31717
|
-
description: "Show gogcli auth
|
|
31724
|
+
description: "Show gogcli auth CONFIGURATION: keyring backend, credential files, and auth setup. Despite the name this is not a health check \u2014 it reads local setup and does not contact Google, so it says nothing about whether an account can still authenticate. Use gog_auth_health for that.",
|
|
31718
31725
|
annotations: { readOnlyHint: true },
|
|
31719
31726
|
inputSchema: {}
|
|
31720
31727
|
}, async () => {
|
|
@@ -31725,7 +31732,7 @@ function registerAuthToolsWith(server, defaultServices) {
|
|
|
31725
31732
|
}
|
|
31726
31733
|
});
|
|
31727
31734
|
server.registerTool("gog_auth_health", {
|
|
31728
|
-
description: 'Check the LIVE health of each stored Google account. Unlike gog_auth_status (which only reports keyring/config setup), this performs a real token refresh against Google, so it detects expired or revoked (invalid_grant) refresh tokens \u2014 the account-wide sign-out that blocks every service. Reports per account: whether the token is currently valid, the mapped cause when it is not, how long ago it was authorized, and a warning as it approaches the 7-day refresh-token limit that applies to OAuth apps whose consent screen is still in "Testing" mode. Run it proactively to re-authorize on your own schedule instead of mid-task.',
|
|
31735
|
+
description: 'Check the LIVE health of each stored Google account. Unlike gog_auth_status (which only reports keyring/config setup), this performs a real token refresh against Google, so it detects expired or revoked (invalid_grant) refresh tokens \u2014 the account-wide sign-out that blocks every service. Reports per account: whether the token is currently valid, the mapped cause when it is not, how long ago it was authorized, and a warning as it approaches the 7-day refresh-token limit that applies to OAuth apps whose consent screen is still in "Testing" mode. Run it proactively to re-authorize on your own schedule instead of mid-task. On the hosted connector this is the ONLY check that measures Google: a connector showing "connected" or "refreshed" has verified the connector key that reaches the gog machine, and nothing else \u2014 the Google credential lives on that machine and can be dead while the connection looks perfectly healthy.',
|
|
31729
31736
|
annotations: { readOnlyHint: true },
|
|
31730
31737
|
inputSchema: {}
|
|
31731
31738
|
}, async () => {
|
|
@@ -31932,14 +31939,29 @@ var failIfNotEmptyParam = external_exports.boolean().optional().describe(
|
|
|
31932
31939
|
);
|
|
31933
31940
|
|
|
31934
31941
|
// ../gogcli-mcp/src/server.ts
|
|
31935
|
-
var VERSION = true ? "2.
|
|
31942
|
+
var VERSION = true ? "2.23.0" : "0.0.0";
|
|
31936
31943
|
|
|
31937
31944
|
// ../gogcli-mcp/src/auth-log.ts
|
|
31938
31945
|
var FAILURES = /* @__PURE__ */ new Set([
|
|
31939
31946
|
"token.mint-failed",
|
|
31940
31947
|
"grant.dead",
|
|
31941
31948
|
"replay.failed",
|
|
31942
|
-
"runner.auth-failed"
|
|
31949
|
+
"runner.auth-failed",
|
|
31950
|
+
"connect.key-rejected",
|
|
31951
|
+
// An enrolment that could not proceed is a failure even though nobody is at
|
|
31952
|
+
// fault: it is the only trace a half-enrolled connector leaves behind, and
|
|
31953
|
+
// the absence of exactly this record is why DEFECT 4 could not be explained.
|
|
31954
|
+
"connect.runner-unreachable",
|
|
31955
|
+
"connect.google-unhealthy",
|
|
31956
|
+
"refusal.google-unhealthy",
|
|
31957
|
+
// The loudest record on this branch, and the only one that means "we cannot
|
|
31958
|
+
// explain this". Google refused a real call while a live check of the same
|
|
31959
|
+
// credential, taken seconds later, succeeded — so neither the 7-day cliff nor
|
|
31960
|
+
// a revoked grant accounts for it. It is filed as a failure precisely because
|
|
31961
|
+
// it is the record nobody may scroll past: it is the only evidence that could
|
|
31962
|
+
// ever justify building something on the hosted path, and its absence over
|
|
31963
|
+
// time is what retires that theory for good.
|
|
31964
|
+
"refusal.google-ok"
|
|
31943
31965
|
]);
|
|
31944
31966
|
var PREFIX = "gog-auth ";
|
|
31945
31967
|
var TAG_CHARS = 12;
|
|
@@ -32086,10 +32108,39 @@ async function exchange(refreshToken, clientId, clientSecret) {
|
|
|
32086
32108
|
return { accessToken: body.access_token, expiresAt: Date.now() + expiresInMs };
|
|
32087
32109
|
}
|
|
32088
32110
|
|
|
32111
|
+
// ../gogcli-mcp/src/google-probe.ts
|
|
32112
|
+
var bool = (value) => typeof value === "boolean" ? value : void 0;
|
|
32113
|
+
var cause = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
32114
|
+
function readGoogleProbe(body) {
|
|
32115
|
+
const record2 = typeof body === "object" && body !== null ? body : {};
|
|
32116
|
+
const measured = bool(record2.measured);
|
|
32117
|
+
const reported = cause(record2.error);
|
|
32118
|
+
if (measured === false) {
|
|
32119
|
+
return {
|
|
32120
|
+
kind: "unmeasured",
|
|
32121
|
+
reason: reported ?? "the runner reported it could not measure the Google layer"
|
|
32122
|
+
};
|
|
32123
|
+
}
|
|
32124
|
+
if (measured === true) {
|
|
32125
|
+
if (bool(record2.ok) === true) return { kind: "ok" };
|
|
32126
|
+
return {
|
|
32127
|
+
kind: "unhealthy",
|
|
32128
|
+
reason: reported ?? "the runner reported the Google layer unhealthy with no cause"
|
|
32129
|
+
};
|
|
32130
|
+
}
|
|
32131
|
+
return {
|
|
32132
|
+
kind: "unmeasured",
|
|
32133
|
+
reason: reported ? `the runner did not report whether it measured the Google layer; it said: ${reported}` : "the runner did not report whether it measured the Google layer"
|
|
32134
|
+
};
|
|
32135
|
+
}
|
|
32136
|
+
|
|
32089
32137
|
// ../gogcli-mcp/src/connector-runtime.ts
|
|
32090
32138
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
32091
32139
|
var DEADLINE_GRACE_MS = 5e3;
|
|
32092
32140
|
var MIN_REPLAY_BUDGET_MS = 1e3;
|
|
32141
|
+
var REFUSAL_PROBE_TIMEOUT_MS = 4e3;
|
|
32142
|
+
var MIN_PROBE_BUDGET_MS = 1e3;
|
|
32143
|
+
var PROBE_INTERVAL_MS = 6e4;
|
|
32093
32144
|
var RUNNER_GOG_FAILED = 422;
|
|
32094
32145
|
var RUNNER_DRAINING = 503;
|
|
32095
32146
|
var RUNNER_BAD_REQUEST = 400;
|
|
@@ -32136,7 +32187,7 @@ function gogTarget(args) {
|
|
|
32136
32187
|
}
|
|
32137
32188
|
return { service };
|
|
32138
32189
|
}
|
|
32139
|
-
async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt) {
|
|
32190
|
+
async function remintAfterGoogleRejection(err, used, args, readAccessToken, deadlineAt, probeGoogle) {
|
|
32140
32191
|
if (!(err instanceof GogFailedError)) return void 0;
|
|
32141
32192
|
const grantDead = REFRESH_TOKEN_DEAD_PATTERN.test(err.stderr);
|
|
32142
32193
|
if (!grantDead && !GOOGLE_TOKEN_REJECTED_PATTERN.test(err.stderr)) return void 0;
|
|
@@ -32151,6 +32202,7 @@ async function remintAfterGoogleRejection(err, used, args, readAccessToken, dead
|
|
|
32151
32202
|
return void 0;
|
|
32152
32203
|
}
|
|
32153
32204
|
if (!used) {
|
|
32205
|
+
await probeGoogle(where);
|
|
32154
32206
|
logAuthTransition("replay.declined", {
|
|
32155
32207
|
...where,
|
|
32156
32208
|
reason: "no access token was supplied with the call, so gog acted as the backend volume\u2019s own identity"
|
|
@@ -32198,6 +32250,64 @@ async function remintAfterGoogleRejection(err, used, args, readAccessToken, dead
|
|
|
32198
32250
|
return { token: fresh, budgetMs, invalidate: readAccessToken.invalidate, ...where };
|
|
32199
32251
|
}
|
|
32200
32252
|
function makeFlyExecutor(endpoint, key, readAccessToken) {
|
|
32253
|
+
let lastProbeAt = Number.NEGATIVE_INFINITY;
|
|
32254
|
+
const probeGoogleAfterRefusal = async (where, deadlineAt) => {
|
|
32255
|
+
const record2 = { ...where, endpoint };
|
|
32256
|
+
const now = Date.now();
|
|
32257
|
+
const remainingMs = deadlineAt - now;
|
|
32258
|
+
if (remainingMs < MIN_PROBE_BUDGET_MS) {
|
|
32259
|
+
logAuthTransition("refusal.google-unmeasured", {
|
|
32260
|
+
...record2,
|
|
32261
|
+
reason: `only ${remainingMs}ms of the call\u2019s deadline remained, so the Google layer was not measured rather than delay the caller\u2019s own error`
|
|
32262
|
+
});
|
|
32263
|
+
return;
|
|
32264
|
+
}
|
|
32265
|
+
if (now - lastProbeAt < PROBE_INTERVAL_MS) {
|
|
32266
|
+
logAuthTransition("refusal.google-unmeasured", {
|
|
32267
|
+
...record2,
|
|
32268
|
+
// "attempted", not "measured". `lastProbeAt` is stamped before the
|
|
32269
|
+
// fetch and is deliberately NOT reset when the probe comes back with no
|
|
32270
|
+
// verdict (a 404 from a runner too old to have the endpoint, a timeout,
|
|
32271
|
+
// a dead socket) — the backend cost this throttle exists to bound was
|
|
32272
|
+
// paid either way, and resetting it would let a retry loop storm a
|
|
32273
|
+
// runner that is already unwell. So the timestamp stays and the sentence
|
|
32274
|
+
// has to be the true one: on this branch a log line may not assert a
|
|
32275
|
+
// measurement that never happened, and the previous probe may well have
|
|
32276
|
+
// measured nothing at all.
|
|
32277
|
+
reason: "a Google probe was attempted recently, so another was not sent: this probe spawns gog on the backend and takes the keyring\u2019s exclusive lock"
|
|
32278
|
+
});
|
|
32279
|
+
return;
|
|
32280
|
+
}
|
|
32281
|
+
lastProbeAt = now;
|
|
32282
|
+
let event;
|
|
32283
|
+
let reason;
|
|
32284
|
+
try {
|
|
32285
|
+
const res = await fetch(`${endpoint}/health/google`, {
|
|
32286
|
+
headers: { Authorization: `Bearer ${key}` },
|
|
32287
|
+
// Never more than the probe's own budget, never more than the call has
|
|
32288
|
+
// left. `Math.min` rather than a plain constant because the second
|
|
32289
|
+
// bound is the caller's, and it outranks ours.
|
|
32290
|
+
signal: AbortSignal.timeout(Math.min(REFUSAL_PROBE_TIMEOUT_MS, remainingMs))
|
|
32291
|
+
});
|
|
32292
|
+
if (!res.ok) {
|
|
32293
|
+
event = "refusal.google-unmeasured";
|
|
32294
|
+
reason = `the runner did not answer the Google probe (HTTP ${res.status})`;
|
|
32295
|
+
} else {
|
|
32296
|
+
const verdict = readGoogleProbe(await res.json());
|
|
32297
|
+
if (verdict.kind === "ok") {
|
|
32298
|
+
event = "refusal.google-ok";
|
|
32299
|
+
reason = "Google refused this call, yet a live token check on the same volume succeeded \u2014 so a dead or expired refresh token does not explain this refusal";
|
|
32300
|
+
} else {
|
|
32301
|
+
event = verdict.kind === "unhealthy" ? "refusal.google-unhealthy" : "refusal.google-unmeasured";
|
|
32302
|
+
reason = verdict.reason;
|
|
32303
|
+
}
|
|
32304
|
+
}
|
|
32305
|
+
} catch (err) {
|
|
32306
|
+
event = "refusal.google-unmeasured";
|
|
32307
|
+
reason = err instanceof Error ? err.message : String(err);
|
|
32308
|
+
}
|
|
32309
|
+
logAuthTransition(event, { ...record2, reason });
|
|
32310
|
+
};
|
|
32201
32311
|
return async (args, opts) => {
|
|
32202
32312
|
const deadlineMs = (opts?.timeout ?? DEFAULT_TIMEOUT_MS) + DEADLINE_GRACE_MS;
|
|
32203
32313
|
const accessToken = await readAccessToken?.();
|
|
@@ -32210,7 +32320,8 @@ function makeFlyExecutor(endpoint, key, readAccessToken) {
|
|
|
32210
32320
|
accessToken,
|
|
32211
32321
|
args,
|
|
32212
32322
|
readAccessToken,
|
|
32213
|
-
deadlineAt
|
|
32323
|
+
deadlineAt,
|
|
32324
|
+
(where2) => probeGoogleAfterRefusal(where2, deadlineAt)
|
|
32214
32325
|
);
|
|
32215
32326
|
if (replay === void 0) throw err;
|
|
32216
32327
|
const where = { credential: replay.credential, service: replay.service, endpoint };
|
|
@@ -32559,7 +32670,7 @@ function registerExtraDocsTools(server) {
|
|
|
32559
32670
|
inputSchema: {
|
|
32560
32671
|
docId: external_exports.string().describe("Doc ID (from the URL)"),
|
|
32561
32672
|
text: external_exports.string().optional().describe("Text content to append"),
|
|
32562
|
-
file: external_exports.string().optional().describe(
|
|
32673
|
+
file: external_exports.string().optional().describe(`Path to a text file to append, read on the gog server. gog also accepts "-" for stdin, but this server never writes to gog's stdin, so "-" would hang until the call times out.`),
|
|
32563
32674
|
markdown: external_exports.boolean().optional().describe("Convert markdown to Google Docs formatting (headings, bold, lists, etc.). See the tool description for known upstream limitations around tables."),
|
|
32564
32675
|
tab: external_exports.string().optional().describe("Target tab title or ID (for multi-tab docs)"),
|
|
32565
32676
|
account: accountParam
|
|
@@ -32641,19 +32752,23 @@ function registerExtraDocsTools(server) {
|
|
|
32641
32752
|
return runOrDiagnose(args, { account });
|
|
32642
32753
|
});
|
|
32643
32754
|
server.registerTool("gog_docs_comments_list", {
|
|
32644
|
-
description: "List comments on a Google Doc. Returns open comments by default; set includeResolved=true to include resolved comments.",
|
|
32755
|
+
description: "List comments on a Google Doc. Returns open comments by default; set includeResolved=true to include resolved comments. Set locate=true (or pass tab) to attach each comment's tab and Docs index ranges as location.matches[] plus location.orphaned \u2014 that costs one extra document fetch, but only one for the whole listing, where gog_docs_comments_locate costs one per comment. Either flag additionally requires the Docs scope; the plain listing needs only Drive. matches[] always spans every tab, so a quote appearing in two tabs is visible as an ambiguity rather than silently resolved. tab keeps only comments with a match in that tab, which drops orphaned comments and comments that quote nothing.",
|
|
32645
32756
|
annotations: { readOnlyHint: true },
|
|
32646
32757
|
inputSchema: {
|
|
32647
32758
|
docId: external_exports.string().describe("Doc ID (from the URL)"),
|
|
32648
32759
|
includeResolved: external_exports.boolean().optional().describe("Include resolved comments (default: false, open only)"),
|
|
32649
32760
|
since: external_exports.string().optional().describe("Only return comments modified at or after this RFC3339 timestamp (e.g. 2026-06-01T00:00:00Z)"),
|
|
32761
|
+
locate: external_exports.boolean().optional().describe("Attach each comment's tab and Docs index ranges (location.matches[] + location.orphaned) using one extra document fetch shared across the whole listing"),
|
|
32762
|
+
tab: external_exports.string().optional().describe("Only return comments whose quoted text resolves inside this tab (title or ID). Implies locate, and drops orphaned and unquoted comments."),
|
|
32650
32763
|
...paginationParams,
|
|
32651
32764
|
account: accountParam
|
|
32652
32765
|
}
|
|
32653
|
-
}, async ({ docId, includeResolved, since, max, page, all, account }) => {
|
|
32766
|
+
}, async ({ docId, includeResolved, since, locate, tab, max, page, all, account }) => {
|
|
32654
32767
|
const args = ["docs", "comments", "list", docId];
|
|
32655
32768
|
if (includeResolved) args.push("--include-resolved");
|
|
32656
32769
|
if (since) args.push(`--since=${since}`);
|
|
32770
|
+
if (locate) args.push("--locate");
|
|
32771
|
+
if (tab) args.push(`--tab=${tab}`);
|
|
32657
32772
|
pushPaginationFlags(args, { max, page, all });
|
|
32658
32773
|
return runOrDiagnose(args, { account });
|
|
32659
32774
|
});
|
|
@@ -33386,7 +33501,7 @@ function registerExtraDocsTools(server) {
|
|
|
33386
33501
|
inputSchema: {
|
|
33387
33502
|
docId: external_exports.string().describe("Doc ID (from the URL)"),
|
|
33388
33503
|
text: external_exports.string().optional().describe("Footnote text"),
|
|
33389
|
-
file: external_exports.string().optional().describe(
|
|
33504
|
+
file: external_exports.string().optional().describe(`Read footnote text from a file on the gog server. gog also accepts "-" for stdin, but this server never writes to gog's stdin, so "-" would hang until the call times out.`),
|
|
33390
33505
|
index: external_exports.number().int().optional().describe("Character index to place the reference mark at (1 = beginning). Omit or use atEnd for end-of-doc."),
|
|
33391
33506
|
atEnd: external_exports.boolean().optional().describe("Target end-of-doc/tab (mutually exclusive with index and at)"),
|
|
33392
33507
|
at: external_exports.string().optional().describe("Anchor by literal text and place the reference mark at the start of the matched range"),
|
|
@@ -33505,7 +33620,7 @@ function registerExtraDocsTools(server) {
|
|
|
33505
33620
|
inputSchema: {
|
|
33506
33621
|
docId: external_exports.string().describe("Doc ID (from the URL)"),
|
|
33507
33622
|
text: external_exports.string().optional().describe("Initial header text"),
|
|
33508
|
-
file: external_exports.string().optional().describe(
|
|
33623
|
+
file: external_exports.string().optional().describe(`Read initial header text from a file on the gog server. gog also accepts "-" for stdin, but this server never writes to gog's stdin, so "-" would hang until the call times out.`),
|
|
33509
33624
|
index: external_exports.number().int().optional().describe("Character index identifying the section the header belongs to (1 = beginning). Omit or use atEnd for end-of-doc."),
|
|
33510
33625
|
atEnd: external_exports.boolean().optional().describe("Target end-of-doc/tab (mutually exclusive with index and at)"),
|
|
33511
33626
|
at: external_exports.string().optional().describe("Anchor by literal text and target the section at the start of the matched range"),
|
|
@@ -33559,7 +33674,7 @@ function registerExtraDocsTools(server) {
|
|
|
33559
33674
|
inputSchema: {
|
|
33560
33675
|
docId: external_exports.string().describe("Doc ID (from the URL)"),
|
|
33561
33676
|
text: external_exports.string().optional().describe("Initial footer text"),
|
|
33562
|
-
file: external_exports.string().optional().describe(
|
|
33677
|
+
file: external_exports.string().optional().describe(`Read initial footer text from a file on the gog server. gog also accepts "-" for stdin, but this server never writes to gog's stdin, so "-" would hang until the call times out.`),
|
|
33563
33678
|
index: external_exports.number().int().optional().describe("Character index identifying the section the footer belongs to (1 = beginning). Omit or use atEnd for end-of-doc."),
|
|
33564
33679
|
atEnd: external_exports.boolean().optional().describe("Target end-of-doc/tab (mutually exclusive with index and at)"),
|
|
33565
33680
|
at: external_exports.string().optional().describe("Anchor by literal text and target the section at the start of the matched range"),
|
package/manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"manifest_version": "0.3",
|
|
4
4
|
"name": "gogcli-mcp-docs",
|
|
5
5
|
"display_name": "gogcli (Docs)",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.23.0",
|
|
7
7
|
"description": "Extended Google Docs for Claude via gogcli — auth + full Docs and comments support",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Chris Hall",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
"name": "gog_docs_comments_list",
|
|
168
|
-
"description": "List comments on a Google Doc. Returns open comments by default; set includeResolved=true to include resolved comments."
|
|
168
|
+
"description": "List comments on a Google Doc. Returns open comments by default; set includeResolved=true to include resolved comments, or locate/tab to attach each comment's tab and index ranges in one extra fetch."
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
"name": "gog_docs_comments_get",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gogcli-mcp-docs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"mcpName": "io.github.chrischall/gogcli-mcp-docs",
|
|
5
5
|
"description": "Extended Google Docs MCP server via gogcli — all base tools plus full Docs support",
|
|
6
6
|
"author": "Claude Code (AI) <https://www.anthropic.com/claude>",
|
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"source": "github",
|
|
8
8
|
"subfolder": "packages/gogcli-mcp-docs"
|
|
9
9
|
},
|
|
10
|
-
"version": "2.
|
|
10
|
+
"version": "2.23.0",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "gogcli-mcp-docs",
|
|
15
|
-
"version": "2.
|
|
15
|
+
"version": "2.23.0",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
},
|
package/src/tools/docs-extra.ts
CHANGED
|
@@ -284,7 +284,7 @@ export function registerExtraDocsTools(server: McpServer): void {
|
|
|
284
284
|
inputSchema: {
|
|
285
285
|
docId: z.string().describe('Doc ID (from the URL)'),
|
|
286
286
|
text: z.string().optional().describe('Text content to append'),
|
|
287
|
-
file: z.string().optional().describe('Path to a text file to append
|
|
287
|
+
file: z.string().optional().describe('Path to a text file to append, read on the gog server. gog also accepts "-" for stdin, but this server never writes to gog\'s stdin, so "-" would hang until the call times out.'),
|
|
288
288
|
markdown: z.boolean().optional().describe('Convert markdown to Google Docs formatting (headings, bold, lists, etc.). See the tool description for known upstream limitations around tables.'),
|
|
289
289
|
tab: z.string().optional().describe('Target tab title or ID (for multi-tab docs)'),
|
|
290
290
|
account: accountParam,
|
|
@@ -372,19 +372,28 @@ export function registerExtraDocsTools(server: McpServer): void {
|
|
|
372
372
|
// Comment-thread tools
|
|
373
373
|
server.registerTool('gog_docs_comments_list', {
|
|
374
374
|
description:
|
|
375
|
-
'List comments on a Google Doc. Returns open comments by default; set includeResolved=true to include resolved comments.'
|
|
375
|
+
'List comments on a Google Doc. Returns open comments by default; set includeResolved=true to include resolved comments. ' +
|
|
376
|
+
'Set locate=true (or pass tab) to attach each comment\'s tab and Docs index ranges as location.matches[] plus location.orphaned — ' +
|
|
377
|
+
'that costs one extra document fetch, but only one for the whole listing, where gog_docs_comments_locate costs one per comment. ' +
|
|
378
|
+
'Either flag additionally requires the Docs scope; the plain listing needs only Drive. ' +
|
|
379
|
+
'matches[] always spans every tab, so a quote appearing in two tabs is visible as an ambiguity rather than silently resolved. ' +
|
|
380
|
+
'tab keeps only comments with a match in that tab, which drops orphaned comments and comments that quote nothing.',
|
|
376
381
|
annotations: { readOnlyHint: true },
|
|
377
382
|
inputSchema: {
|
|
378
383
|
docId: z.string().describe('Doc ID (from the URL)'),
|
|
379
384
|
includeResolved: z.boolean().optional().describe('Include resolved comments (default: false, open only)'),
|
|
380
385
|
since: z.string().optional().describe('Only return comments modified at or after this RFC3339 timestamp (e.g. 2026-06-01T00:00:00Z)'),
|
|
386
|
+
locate: z.boolean().optional().describe('Attach each comment\'s tab and Docs index ranges (location.matches[] + location.orphaned) using one extra document fetch shared across the whole listing'),
|
|
387
|
+
tab: z.string().optional().describe('Only return comments whose quoted text resolves inside this tab (title or ID). Implies locate, and drops orphaned and unquoted comments.'),
|
|
381
388
|
...paginationParams,
|
|
382
389
|
account: accountParam,
|
|
383
390
|
},
|
|
384
|
-
}, async ({ docId, includeResolved, since, max, page, all, account }) => {
|
|
391
|
+
}, async ({ docId, includeResolved, since, locate, tab, max, page, all, account }) => {
|
|
385
392
|
const args = ['docs', 'comments', 'list', docId];
|
|
386
393
|
if (includeResolved) args.push('--include-resolved');
|
|
387
394
|
if (since) args.push(`--since=${since}`);
|
|
395
|
+
if (locate) args.push('--locate');
|
|
396
|
+
if (tab) args.push(`--tab=${tab}`);
|
|
388
397
|
pushPaginationFlags(args, { max, page, all });
|
|
389
398
|
return runOrDiagnose(args, { account });
|
|
390
399
|
});
|
|
@@ -1177,7 +1186,7 @@ export function registerExtraDocsTools(server: McpServer): void {
|
|
|
1177
1186
|
inputSchema: {
|
|
1178
1187
|
docId: z.string().describe('Doc ID (from the URL)'),
|
|
1179
1188
|
text: z.string().optional().describe('Footnote text'),
|
|
1180
|
-
file: z.string().optional().describe('Read footnote text from a file
|
|
1189
|
+
file: z.string().optional().describe('Read footnote text from a file on the gog server. gog also accepts "-" for stdin, but this server never writes to gog\'s stdin, so "-" would hang until the call times out.'),
|
|
1181
1190
|
index: z.number().int().optional().describe('Character index to place the reference mark at (1 = beginning). Omit or use atEnd for end-of-doc.'),
|
|
1182
1191
|
atEnd: z.boolean().optional().describe('Target end-of-doc/tab (mutually exclusive with index and at)'),
|
|
1183
1192
|
at: z.string().optional().describe('Anchor by literal text and place the reference mark at the start of the matched range'),
|
|
@@ -1304,7 +1313,7 @@ export function registerExtraDocsTools(server: McpServer): void {
|
|
|
1304
1313
|
inputSchema: {
|
|
1305
1314
|
docId: z.string().describe('Doc ID (from the URL)'),
|
|
1306
1315
|
text: z.string().optional().describe('Initial header text'),
|
|
1307
|
-
file: z.string().optional().describe('Read initial header text from a file
|
|
1316
|
+
file: z.string().optional().describe('Read initial header text from a file on the gog server. gog also accepts "-" for stdin, but this server never writes to gog\'s stdin, so "-" would hang until the call times out.'),
|
|
1308
1317
|
index: z.number().int().optional().describe('Character index identifying the section the header belongs to (1 = beginning). Omit or use atEnd for end-of-doc.'),
|
|
1309
1318
|
atEnd: z.boolean().optional().describe('Target end-of-doc/tab (mutually exclusive with index and at)'),
|
|
1310
1319
|
at: z.string().optional().describe('Anchor by literal text and target the section at the start of the matched range'),
|
|
@@ -1361,7 +1370,7 @@ export function registerExtraDocsTools(server: McpServer): void {
|
|
|
1361
1370
|
inputSchema: {
|
|
1362
1371
|
docId: z.string().describe('Doc ID (from the URL)'),
|
|
1363
1372
|
text: z.string().optional().describe('Initial footer text'),
|
|
1364
|
-
file: z.string().optional().describe('Read initial footer text from a file
|
|
1373
|
+
file: z.string().optional().describe('Read initial footer text from a file on the gog server. gog also accepts "-" for stdin, but this server never writes to gog\'s stdin, so "-" would hang until the call times out.'),
|
|
1365
1374
|
index: z.number().int().optional().describe('Character index identifying the section the footer belongs to (1 = beginning). Omit or use atEnd for end-of-doc.'),
|
|
1366
1375
|
atEnd: z.boolean().optional().describe('Target end-of-doc/tab (mutually exclusive with index and at)'),
|
|
1367
1376
|
at: z.string().optional().describe('Anchor by literal text and target the section at the start of the matched range'),
|
|
@@ -503,6 +503,82 @@ describe('gog_docs_comments_list', () => {
|
|
|
503
503
|
{ account: undefined },
|
|
504
504
|
);
|
|
505
505
|
});
|
|
506
|
+
|
|
507
|
+
// gog 0.35.0 (openclaw/gogcli#965) adds --locate/--tab, which share ONE
|
|
508
|
+
// documents.get(includeTabsContent=true) across every comment on the page.
|
|
509
|
+
// The pre-0.35.0 way to answer "which tab is this comment in?" was one
|
|
510
|
+
// `docs comments locate` per comment — 30 fetches for a 30-comment doc.
|
|
511
|
+
it('includes --locate when requested', async () => {
|
|
512
|
+
vi.mocked(lib.runOrDiagnose).mockResolvedValue(rawTextResult('{}'));
|
|
513
|
+
const harness = await setupHandlers();
|
|
514
|
+
await harness.callTool('gog_docs_comments_list', { docId: 'abc', locate: true });
|
|
515
|
+
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
516
|
+
['docs', 'comments', 'list', 'abc', '--locate'],
|
|
517
|
+
{ account: undefined },
|
|
518
|
+
);
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
it('omits --locate when false', async () => {
|
|
522
|
+
vi.mocked(lib.runOrDiagnose).mockResolvedValue(rawTextResult('{}'));
|
|
523
|
+
const harness = await setupHandlers();
|
|
524
|
+
await harness.callTool('gog_docs_comments_list', { docId: 'abc', locate: false });
|
|
525
|
+
expect(lib.runOrDiagnose).toHaveBeenCalledWith(['docs', 'comments', 'list', 'abc'], { account: undefined });
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
it('includes --tab, which gog treats as implying --locate', async () => {
|
|
529
|
+
vi.mocked(lib.runOrDiagnose).mockResolvedValue(rawTextResult('{}'));
|
|
530
|
+
const harness = await setupHandlers();
|
|
531
|
+
await harness.callTool('gog_docs_comments_list', { docId: 'abc', tab: 'Notes' });
|
|
532
|
+
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
533
|
+
['docs', 'comments', 'list', 'abc', '--tab=Notes'],
|
|
534
|
+
{ account: undefined },
|
|
535
|
+
);
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
// gog rejects an explicitly empty --tab (`--tab requires a non-empty tab
|
|
539
|
+
// title or ID`), so an empty string must never reach the arg array.
|
|
540
|
+
it('never emits an empty --tab', async () => {
|
|
541
|
+
vi.mocked(lib.runOrDiagnose).mockResolvedValue(rawTextResult('{}'));
|
|
542
|
+
const harness = await setupHandlers();
|
|
543
|
+
await harness.callTool('gog_docs_comments_list', { docId: 'abc', tab: '' });
|
|
544
|
+
expect(lib.runOrDiagnose).toHaveBeenCalledWith(['docs', 'comments', 'list', 'abc'], { account: undefined });
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it('combines --locate and --tab with the existing filters and pagination', async () => {
|
|
548
|
+
vi.mocked(lib.runOrDiagnose).mockResolvedValue(rawTextResult('{}'));
|
|
549
|
+
const harness = await setupHandlers();
|
|
550
|
+
await harness.callTool('gog_docs_comments_list', {
|
|
551
|
+
docId: 'abc', includeResolved: true, since: '2026-06-01T00:00:00Z',
|
|
552
|
+
locate: true, tab: 'Notes', max: 10, page: 'tok', all: true,
|
|
553
|
+
});
|
|
554
|
+
expect(lib.runOrDiagnose).toHaveBeenCalledWith(
|
|
555
|
+
[
|
|
556
|
+
'docs', 'comments', 'list', 'abc',
|
|
557
|
+
'--include-resolved',
|
|
558
|
+
'--since=2026-06-01T00:00:00Z',
|
|
559
|
+
'--locate',
|
|
560
|
+
'--tab=Notes',
|
|
561
|
+
'--max=10', '--page=tok', '--all',
|
|
562
|
+
],
|
|
563
|
+
{ account: undefined },
|
|
564
|
+
);
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
it('description states the extra fetch, the Docs scope, and that --tab drops orphans', async () => {
|
|
568
|
+
const { McpServer } = await import('@modelcontextprotocol/sdk/server/mcp.js');
|
|
569
|
+
const server = new McpServer({ name: 'test', version: '0.0.0' });
|
|
570
|
+
const configs = new Map<string, { description?: string }>();
|
|
571
|
+
vi.spyOn(server, 'registerTool').mockImplementation((name, config) => {
|
|
572
|
+
configs.set(name, config as { description?: string });
|
|
573
|
+
return undefined as never;
|
|
574
|
+
});
|
|
575
|
+
const { registerExtraDocsTools } = await import('../../src/tools/docs-extra.js');
|
|
576
|
+
registerExtraDocsTools(server);
|
|
577
|
+
const desc = configs.get('gog_docs_comments_list')?.description ?? '';
|
|
578
|
+
expect(desc).toMatch(/one extra/i);
|
|
579
|
+
expect(desc).toMatch(/Docs scope/);
|
|
580
|
+
expect(desc).toMatch(/orphan/i);
|
|
581
|
+
});
|
|
506
582
|
});
|
|
507
583
|
|
|
508
584
|
describe('gog_docs_table_column_width', () => {
|
|
@@ -2156,3 +2232,35 @@ describe('gog_docs_format spacingMode', () => {
|
|
|
2156
2232
|
);
|
|
2157
2233
|
});
|
|
2158
2234
|
});
|
|
2235
|
+
|
|
2236
|
+
// Same trap the gmail package documents: gog resolves a "-" path through
|
|
2237
|
+
// io.ReadAll(stdinReader(ctx)) (docs_helpers.go resolveContentInput:26 and
|
|
2238
|
+
// readTextInput:83 at upstream-v0.35.0 — os.Stdin, unaffected by --no-input),
|
|
2239
|
+
// but runner.ts spawns with default stdio and never writes to or ends
|
|
2240
|
+
// child.stdin, so the call blocks until the 30s timeout fires. Reproduced
|
|
2241
|
+
// against a live gog v0.35.0: the child was still running with zero output
|
|
2242
|
+
// after 5s. These descriptions must warn, not offer.
|
|
2243
|
+
describe('server-side file params never advertise stdin as usable', () => {
|
|
2244
|
+
const STDIN_PARAMS: Array<[tool: string, param: string]> = [
|
|
2245
|
+
['gog_docs_append', 'file'],
|
|
2246
|
+
['gog_docs_insert_footnote', 'file'],
|
|
2247
|
+
['gog_docs_header_create', 'file'],
|
|
2248
|
+
['gog_docs_footer_create', 'file'],
|
|
2249
|
+
];
|
|
2250
|
+
|
|
2251
|
+
it.each(STDIN_PARAMS)('%s.%s warns that stdin hangs instead of offering it', async (tool, param) => {
|
|
2252
|
+
const { McpServer } = await import('@modelcontextprotocol/sdk/server/mcp.js');
|
|
2253
|
+
const server = new McpServer({ name: 'test', version: '0.0.0' });
|
|
2254
|
+
const schemas = new Map<string, Record<string, { description?: string }>>();
|
|
2255
|
+
vi.spyOn(server, 'registerTool').mockImplementation((name, config) => {
|
|
2256
|
+
schemas.set(name, (config as { inputSchema: Record<string, { description?: string }> }).inputSchema);
|
|
2257
|
+
return undefined as never;
|
|
2258
|
+
});
|
|
2259
|
+
registerExtraDocsTools(server);
|
|
2260
|
+
const desc = schemas.get(tool)?.[param]?.description ?? '';
|
|
2261
|
+
expect(desc).not.toBe('');
|
|
2262
|
+
expect(desc).not.toMatch(/(?:use|or)\s+"?-"?\s*(?:for|to read)/i);
|
|
2263
|
+
expect(desc).toMatch(/stdin/i);
|
|
2264
|
+
expect(desc).toMatch(/hang|never writes/i);
|
|
2265
|
+
});
|
|
2266
|
+
});
|