@charlie.act7/gemini-notebook-mcp 2.1.2 → 2.3.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.
Files changed (122) hide show
  1. package/README.md +461 -434
  2. package/dist/auth/auth-manager.d.ts +2 -6
  3. package/dist/auth/auth-manager.d.ts.map +1 -1
  4. package/dist/auth/auth-manager.js +50 -58
  5. package/dist/auth/auth-manager.js.map +1 -1
  6. package/dist/config.d.ts +3 -0
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +8 -0
  9. package/dist/config.js.map +1 -1
  10. package/dist/errors.d.ts +18 -5
  11. package/dist/errors.d.ts.map +1 -1
  12. package/dist/errors.js +69 -6
  13. package/dist/errors.js.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +101 -48
  16. package/dist/index.js.map +1 -1
  17. package/dist/library/notebook-library.d.ts +7 -3
  18. package/dist/library/notebook-library.d.ts.map +1 -1
  19. package/dist/library/notebook-library.js +190 -35
  20. package/dist/library/notebook-library.js.map +1 -1
  21. package/dist/library/types.d.ts +18 -0
  22. package/dist/library/types.d.ts.map +1 -1
  23. package/dist/notebooklm/artifact-store.d.ts +26 -0
  24. package/dist/notebooklm/artifact-store.d.ts.map +1 -0
  25. package/dist/notebooklm/artifact-store.js +102 -0
  26. package/dist/notebooklm/artifact-store.js.map +1 -0
  27. package/dist/notebooklm/audio.d.ts +3 -0
  28. package/dist/notebooklm/audio.d.ts.map +1 -1
  29. package/dist/notebooklm/audio.js +72 -39
  30. package/dist/notebooklm/audio.js.map +1 -1
  31. package/dist/notebooklm/chat.d.ts.map +1 -1
  32. package/dist/notebooklm/chat.js +22 -14
  33. package/dist/notebooklm/chat.js.map +1 -1
  34. package/dist/notebooklm/citations.d.ts +17 -22
  35. package/dist/notebooklm/citations.d.ts.map +1 -1
  36. package/dist/notebooklm/citations.js +148 -115
  37. package/dist/notebooklm/citations.js.map +1 -1
  38. package/dist/notebooklm/selectors.d.ts +54 -2
  39. package/dist/notebooklm/selectors.d.ts.map +1 -1
  40. package/dist/notebooklm/selectors.js +109 -2
  41. package/dist/notebooklm/selectors.js.map +1 -1
  42. package/dist/notebooklm/sources.d.ts +18 -3
  43. package/dist/notebooklm/sources.d.ts.map +1 -1
  44. package/dist/notebooklm/sources.js +128 -32
  45. package/dist/notebooklm/sources.js.map +1 -1
  46. package/dist/resources/resource-handlers.js +2 -2
  47. package/dist/resources/resource-handlers.js.map +1 -1
  48. package/dist/session/browser-session.d.ts +17 -10
  49. package/dist/session/browser-session.d.ts.map +1 -1
  50. package/dist/session/browser-session.js +165 -169
  51. package/dist/session/browser-session.js.map +1 -1
  52. package/dist/session/session-manager.d.ts +12 -7
  53. package/dist/session/session-manager.d.ts.map +1 -1
  54. package/dist/session/session-manager.js +120 -80
  55. package/dist/session/session-manager.js.map +1 -1
  56. package/dist/session/shared-context-manager.d.ts.map +1 -1
  57. package/dist/session/shared-context-manager.js +12 -10
  58. package/dist/session/shared-context-manager.js.map +1 -1
  59. package/dist/tools/definitions/ask-question.d.ts +4 -3
  60. package/dist/tools/definitions/ask-question.d.ts.map +1 -1
  61. package/dist/tools/definitions/ask-question.js +9 -109
  62. package/dist/tools/definitions/ask-question.js.map +1 -1
  63. package/dist/tools/definitions/notebook-management.d.ts.map +1 -1
  64. package/dist/tools/definitions/notebook-management.js +47 -4
  65. package/dist/tools/definitions/notebook-management.js.map +1 -1
  66. package/dist/tools/definitions/session-management.d.ts.map +1 -1
  67. package/dist/tools/definitions/session-management.js +2 -0
  68. package/dist/tools/definitions/session-management.js.map +1 -1
  69. package/dist/tools/definitions/sources.d.ts +8 -0
  70. package/dist/tools/definitions/sources.d.ts.map +1 -1
  71. package/dist/tools/definitions/sources.js +152 -15
  72. package/dist/tools/definitions/sources.js.map +1 -1
  73. package/dist/tools/definitions/system.d.ts.map +1 -1
  74. package/dist/tools/definitions/system.js +23 -19
  75. package/dist/tools/definitions/system.js.map +1 -1
  76. package/dist/tools/definitions.d.ts +3 -3
  77. package/dist/tools/definitions.d.ts.map +1 -1
  78. package/dist/tools/definitions.js +5 -9
  79. package/dist/tools/definitions.js.map +1 -1
  80. package/dist/tools/handlers.d.ts +101 -14
  81. package/dist/tools/handlers.d.ts.map +1 -1
  82. package/dist/tools/handlers.js +280 -76
  83. package/dist/tools/handlers.js.map +1 -1
  84. package/dist/tools/validation.d.ts +6 -0
  85. package/dist/tools/validation.d.ts.map +1 -0
  86. package/dist/tools/validation.js +267 -0
  87. package/dist/tools/validation.js.map +1 -0
  88. package/dist/transport/http.d.ts +2 -0
  89. package/dist/transport/http.d.ts.map +1 -1
  90. package/dist/transport/http.js +6 -1
  91. package/dist/transport/http.js.map +1 -1
  92. package/dist/types.d.ts +15 -1
  93. package/dist/types.d.ts.map +1 -1
  94. package/dist/utils/cleanup-manager.d.ts +35 -115
  95. package/dist/utils/cleanup-manager.d.ts.map +1 -1
  96. package/dist/utils/cleanup-manager.js +179 -632
  97. package/dist/utils/cleanup-manager.js.map +1 -1
  98. package/dist/utils/disclaimer.d.ts +2 -1
  99. package/dist/utils/disclaimer.d.ts.map +1 -1
  100. package/dist/utils/disclaimer.js +3 -2
  101. package/dist/utils/disclaimer.js.map +1 -1
  102. package/dist/utils/logger.d.ts +26 -39
  103. package/dist/utils/logger.d.ts.map +1 -1
  104. package/dist/utils/logger.js +104 -50
  105. package/dist/utils/logger.js.map +1 -1
  106. package/dist/utils/operation.d.ts +8 -0
  107. package/dist/utils/operation.d.ts.map +1 -0
  108. package/dist/utils/operation.js +42 -0
  109. package/dist/utils/operation.js.map +1 -0
  110. package/dist/utils/page-utils.d.ts.map +1 -1
  111. package/dist/utils/page-utils.js +3 -3
  112. package/dist/utils/page-utils.js.map +1 -1
  113. package/dist/version.d.ts +3 -0
  114. package/dist/version.d.ts.map +1 -0
  115. package/dist/version.js +17 -0
  116. package/dist/version.js.map +1 -0
  117. package/docs/configuration.md +205 -179
  118. package/docs/implementation-plan.md +135 -0
  119. package/docs/tools.md +473 -412
  120. package/docs/troubleshooting.md +161 -159
  121. package/docs/usage-guide.md +282 -282
  122. package/package.json +4 -3
@@ -8,6 +8,7 @@
8
8
  const sharedNotebookTargeting = {
9
9
  session_id: {
10
10
  type: "string",
11
+ format: "uuid",
11
12
  description: "Reuse an existing browser session by id. Recommended when you have " +
12
13
  "already called `ask_question` against the same notebook — saves the " +
13
14
  "10–15 s page-load time. Obtain from `list_sessions` or any prior " +
@@ -28,16 +29,17 @@ const sharedNotebookTargeting = {
28
29
  };
29
30
  export const addSourceTool = {
30
31
  name: "add_source",
31
- description: "Ingest a source into a NotebookLM notebook. Supports two source types " +
32
- "in v2.0:\n" +
32
+ description: "Ingest a source into a NotebookLM notebook. Supports three source types " +
33
+ "in the current browser backend:\n" +
33
34
  " • `url` — NotebookLM crawls and indexes a website\n" +
34
- " • `text` — paste raw text (treated as a copied document)\n\n" +
35
- "File / YouTube / Google-Drive uploads are not yet implemented.\n\n" +
35
+ " • `text` — paste raw text (treated as a copied document)\n" +
36
+ " • `youtube` — import a public YouTube URL\n\n" +
37
+ "File and Google-Drive uploads are not yet exposed because their picker flows require additional permission and path controls.\n\n" +
36
38
  "Returns `sourceCountBefore`/`sourceCountAfter` so the caller can verify " +
37
39
  "the new source landed. Call once per source — multiple sources require " +
38
40
  "multiple calls. NotebookLM finishes indexing within 5–30 seconds; " +
39
41
  "subsequent `ask_question` calls then have the new source in context. " +
40
- "Free notebooks cap at 50 sources.\n\n" +
42
+ "Account and source limits vary; rely on the live Google interface.\n\n" +
41
43
  "Known quirk: pasted-text uploads occasionally redirect to a freshly " +
42
44
  'created "Untitled notebook" on Google\'s side. The tool detects this ' +
43
45
  "and returns a clear error so you can re-try against the correct URL.",
@@ -46,14 +48,14 @@ export const addSourceTool = {
46
48
  properties: {
47
49
  type: {
48
50
  type: "string",
49
- enum: ["url", "text"],
50
- description: "`url` crawls the supplied website; `text` ingests `content` " +
51
- "verbatim as a copied document.",
51
+ enum: ["url", "text", "youtube"],
52
+ description: "`url` crawls a website; `youtube` imports a public video URL; " +
53
+ "`text` ingests `content` verbatim as a copied document.",
52
54
  },
53
55
  content: {
54
56
  type: "string",
55
57
  description: "When `type=url`: a fully-qualified URL (https://…). " +
56
- "When `type=text`: the raw text body (any length up to NotebookLM's per-source word limit, ~500 k for free tier).",
58
+ "When `type=text`: the raw text body, subject to the current per-source limit shown by NotebookLM.",
57
59
  },
58
60
  title: {
59
61
  type: "string",
@@ -78,6 +80,133 @@ export const addSourceTool = {
78
80
  openWorldHint: true,
79
81
  },
80
82
  };
83
+ export const listSourcesTool = {
84
+ name: "list_sources",
85
+ description: "Read the sources currently shown in a notebook sidebar. Returns a stable best-effort `source_id`, name, inferred type, indexing status, URL when exposed by the UI, and position. An empty list is returned only after the source panel was successfully inspected.",
86
+ inputSchema: {
87
+ type: "object",
88
+ properties: { show_browser: { type: "boolean" }, ...sharedNotebookTargeting },
89
+ },
90
+ annotations: { title: "List notebook sources", readOnlyHint: true, openWorldHint: true },
91
+ };
92
+ export const getSourceTool = {
93
+ name: "get_source",
94
+ description: "Get one source from the current notebook inventory by `source_id` (preferred) or exact `name`. Use `list_sources` first when the identifier is unknown.",
95
+ inputSchema: {
96
+ type: "object",
97
+ properties: {
98
+ source_id: { type: "string", description: "Source id returned by `list_sources`." },
99
+ name: { type: "string", description: "Exact visible source name." },
100
+ show_browser: { type: "boolean" },
101
+ ...sharedNotebookTargeting,
102
+ },
103
+ },
104
+ annotations: { title: "Get notebook source", readOnlyHint: true, openWorldHint: true },
105
+ };
106
+ export const getSourceStatusTool = {
107
+ ...getSourceTool,
108
+ name: "get_source_status",
109
+ description: "Refresh one source from the current notebook inventory and return its indexing `status` plus the same structured source fields as `get_source`.",
110
+ annotations: { title: "Get source indexing status", readOnlyHint: true, openWorldHint: true },
111
+ };
112
+ export const batchAddSourcesTool = {
113
+ name: "batch_add_sources",
114
+ description: "Add up to 25 URL, YouTube, or pasted-text sources sequentially in one authenticated notebook session. Stops on the first failure by default and returns a result for every attempted item.",
115
+ inputSchema: {
116
+ type: "object",
117
+ properties: {
118
+ sources: {
119
+ type: "array",
120
+ maxItems: 25,
121
+ items: {
122
+ type: "object",
123
+ properties: {
124
+ type: { type: "string", enum: ["url", "text", "youtube"] },
125
+ content: { type: "string" },
126
+ title: { type: "string" },
127
+ },
128
+ required: ["type", "content"],
129
+ },
130
+ },
131
+ stop_on_error: { type: "boolean", description: "Default true." },
132
+ show_browser: { type: "boolean" },
133
+ ...sharedNotebookTargeting,
134
+ },
135
+ required: ["sources"],
136
+ },
137
+ annotations: {
138
+ title: "Batch add notebook sources",
139
+ readOnlyHint: false,
140
+ destructiveHint: false,
141
+ idempotentHint: false,
142
+ openWorldHint: true,
143
+ },
144
+ };
145
+ export const generateArtifactTool = {
146
+ name: "generate_artifact",
147
+ description: "Start a persistent Studio artifact job. Version 2.3 supports `audio_overview`; the generic job shape allows more Studio artifact types to be added without multiplying tools. Returns a `job_id` that survives MCP restarts.",
148
+ inputSchema: {
149
+ type: "object",
150
+ properties: {
151
+ type: { type: "string", enum: ["audio_overview"] },
152
+ custom_prompt: { type: "string" },
153
+ wait_for_completion: { type: "boolean" },
154
+ timeout_ms: { type: "number" },
155
+ show_browser: { type: "boolean" },
156
+ ...sharedNotebookTargeting,
157
+ },
158
+ required: ["type"],
159
+ },
160
+ annotations: {
161
+ title: "Generate Studio artifact",
162
+ readOnlyHint: false,
163
+ destructiveHint: false,
164
+ idempotentHint: true,
165
+ openWorldHint: true,
166
+ },
167
+ };
168
+ export const listArtifactsTool = {
169
+ name: "list_artifacts",
170
+ description: "List persistent Studio jobs created by this MCP client. Optionally filter by notebook. This reads the local job registry and does not open a browser.",
171
+ inputSchema: {
172
+ type: "object",
173
+ properties: {
174
+ notebook_id: sharedNotebookTargeting.notebook_id,
175
+ notebook_url: sharedNotebookTargeting.notebook_url,
176
+ },
177
+ },
178
+ annotations: { title: "List Studio artifacts", readOnlyHint: true, openWorldHint: false },
179
+ };
180
+ export const getArtifactStatusTool = {
181
+ name: "get_artifact_status",
182
+ description: "Refresh and return a persistent Studio job by `job_id`. For an Audio Overview this probes the live notebook and stores the updated ready/in-progress state.",
183
+ inputSchema: {
184
+ type: "object",
185
+ properties: { job_id: { type: "string", format: "uuid" }, show_browser: { type: "boolean" } },
186
+ required: ["job_id"],
187
+ },
188
+ annotations: { title: "Get artifact status", readOnlyHint: true, openWorldHint: true },
189
+ };
190
+ export const downloadArtifactTool = {
191
+ name: "download_artifact",
192
+ description: "Download a ready artifact job under NOTEBOOKLM_OUTPUT_DIR and persist the resulting path in the job registry.",
193
+ inputSchema: {
194
+ type: "object",
195
+ properties: {
196
+ job_id: { type: "string", format: "uuid" },
197
+ destination_dir: { type: "string" },
198
+ show_browser: { type: "boolean" },
199
+ },
200
+ required: ["job_id", "destination_dir"],
201
+ },
202
+ annotations: {
203
+ title: "Download Studio artifact",
204
+ readOnlyHint: false,
205
+ destructiveHint: false,
206
+ idempotentHint: true,
207
+ openWorldHint: true,
208
+ },
209
+ };
81
210
  export const generateAudioTool = {
82
211
  name: "generate_audio",
83
212
  description: "Trigger podcast-style Audio Overview generation for a notebook.\n\n" +
@@ -93,7 +222,7 @@ export const generateAudioTool = {
93
222
  " 3. When status is `ready`, call `download_audio`\n\n" +
94
223
  "Pass `wait_for_completion: true` for legacy synchronous behaviour " +
95
224
  "(blocks for up to `timeout_ms`). Audio Overview is the only Studio " +
96
- "output exposed in v2.0 (Video / Mindmap / Quiz / Infographic / " +
225
+ "output currently exposed (Video / Mindmap / Quiz / Infographic / " +
97
226
  "Datatable / Presentation are NotebookLM features but not yet wrapped).",
98
227
  inputSchema: {
99
228
  type: "object",
@@ -162,7 +291,8 @@ export const downloadAudioTool = {
162
291
  'condition:** `get_audio_status` must report `status: "ready"`. ' +
163
292
  "Calling this before generation completes returns an error message " +
164
293
  "explaining what to do.\n\n" +
165
- "The file lands in `destination_dir` with NotebookLM's suggested " +
294
+ "The file lands under NOTEBOOKLM_OUTPUT_DIR, using `destination_dir` " +
295
+ "as a relative subdirectory (or an absolute path inside that root), with NotebookLM's suggested " +
166
296
  "filename (sanitised — usually the audio's title with underscores). " +
167
297
  "The full saved path is returned in `result.filePath`.",
168
298
  inputSchema: {
@@ -170,10 +300,9 @@ export const downloadAudioTool = {
170
300
  properties: {
171
301
  destination_dir: {
172
302
  type: "string",
173
- description: "Absolute directory path where the file is saved (created if " +
174
- "missing). Example: `/Users/jane/Downloads/notebooklm` or " +
175
- "`/tmp/audio`. Relative paths are NOT recommended — the server " +
176
- "may run from a different working directory than the caller.",
303
+ description: "Directory under NOTEBOOKLM_OUTPUT_DIR where the file is saved " +
304
+ "(created if missing). Use `.` for the configured output root. " +
305
+ "Absolute paths are accepted only when they remain inside that root.",
177
306
  },
178
307
  show_browser: {
179
308
  type: "boolean",
@@ -193,6 +322,14 @@ export const downloadAudioTool = {
193
322
  };
194
323
  export const sourceTools = [
195
324
  addSourceTool,
325
+ listSourcesTool,
326
+ getSourceTool,
327
+ getSourceStatusTool,
328
+ batchAddSourcesTool,
329
+ generateArtifactTool,
330
+ listArtifactsTool,
331
+ getArtifactStatusTool,
332
+ downloadArtifactTool,
196
333
  generateAudioTool,
197
334
  getAudioStatusTool,
198
335
  downloadAudioTool,
@@ -1 +1 @@
1
- {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/tools/definitions/sources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,uBAAuB,GAAG;IAC9B,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,qEAAqE;YACrE,sEAAsE;YACtE,mEAAmE;YACnE,gDAAgD;KACnD;IACD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,oEAAoE;YACpE,uEAAuE;KAC1E;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,kEAAkE;YAClE,6CAA6C;YAC7C,4DAA4D;YAC5D,iDAAiD;KACpD;CACF,CAAC;AAEF,MAAM,CAAC,MA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QACjE,oEAAoE;QACpE,4BAA4B;QAC5B,kEAAkE;QAClE,qEAAqE;QACrE,uDAAuD;IACzD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,8DAA8D;oBAC9D,2DAA2D;oBAC3D,gEAAgE;oBAChE,6DAA6D;aAChE;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,wDAAwD;aACtE;YACD,GAAG,uBAAuB;SAC3B;QACD,QAAQ,EAAE,CAAC,iBAAiB,CAAC;KAC9B;IACD,WAAW,EAAE;QACX,KAAK,EAAE,yBAAyB;QAChC,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC,aAAa;IACb,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;CAClB,CAAC"}
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/tools/definitions/sources.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,uBAAuB,GAAG;IAC9B,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,MAAM;QACd,WAAW,EACT,qEAAqE;YACrE,sEAAsE;YACtE,mEAAmE;YACnE,gDAAgD;KACnD;IACD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,oEAAoE;YACpE,uEAAuE;KAC1E;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,kEAAkE;YAClE,6CAA6C;YAC7C,4DAA4D;YAC5D,iDAAiD;KACpD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,YAAY;IAClB,WAAW,EACT,0EAA0E;QAC1E,mCA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;QACX,KAAK,EAAE,2BAA2B;QAClC,YAAY,EAAE,IAAI;QAClB,aAAa,EAAE,IAAI;KACpB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAS;IACrC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,oEAAoE;QACpE,iEAAiE;QACjE,oEAAoE;QACpE,4BAA4B;QAC5B,sEAAsE;QACtE,iGAAiG;QACjG,qEAAqE;QACrE,uDAAuD;IACzD,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,gEAAgE;oBAChE,gEAAgE;oBAChE,qEAAqE;aACxE;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,wDAAwD;aACtE;YACD,GAAG,uBAAuB;SAC3B;QACD,QAAQ,EAAE,CAAC,iBAAiB,CAAC;KAC9B;IACD,WAAW,EAAE;QACX,KAAK,EAAE,yBAAyB;QAChC,YAAY,EAAE,KAAK;QACnB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC,aAAa;IACb,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,oBAAoB;IACpB,iBAAiB;IACjB,qBAAqB;IACrB,oBAAoB;IACpB,iBAAiB;IACjB,kBAAkB;IAClB,iBAAiB;CAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,IAAI,EA4J7B,CAAC"}
1
+ {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/tools/definitions/system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,IAAI,EAiK7B,CAAC"}
@@ -32,20 +32,19 @@ export const systemTools = [
32
32
  },
33
33
  {
34
34
  name: "setup_auth",
35
- description: "Open a browser window for first-time Google login. Returns immediately " +
36
- "after spawning the browser; the user has up to 10 minutes to complete " +
37
- "sign-in, then cookies are persisted for future runs. Existing profile " +
35
+ description: "Open a browser window for first-time Google login. The tool call waits " +
36
+ "for completion for up to 10 minutes while reporting progress, then " +
37
+ "persists cookies for future runs. Existing profile " +
38
38
  "data is preserved; use `re_auth` when a clean login is required.\n\n" +
39
39
  "When to use:\n" +
40
40
  " • This is the first run and Google requests sign-in\n" +
41
41
  " • Auto-login credentials are not configured\n" +
42
- " • `re_auth` is the right call when you want to *switch* accounts " +
43
- "or recover from a daily-quota lockout\n\n" +
42
+ " • `re_auth` is the right call when you want to switch accounts\n\n" +
44
43
  "After login finishes, a NotebookLM operation verifies the live session; " +
45
44
  "`get_health` only reports whether the saved backup is readable.\n\n" +
46
- "If the browser session feels broken (auth keeps failing, stale cookies), " +
47
- "run `cleanup_data(confirm=true, preserve_library=true)` first, then " +
48
- "retry `setup_auth`.",
45
+ "If the browser session remains broken, preview `cleanup_data` with " +
46
+ "`preserve_library=true`, obtain explicit approval, then execute using " +
47
+ "the returned preview token before retrying `setup_auth`.",
49
48
  inputSchema: {
50
49
  type: "object",
51
50
  properties: {
@@ -80,11 +79,11 @@ export const systemTools = [
80
79
  "Closes all active sessions, deletes saved cookies and Chrome profile, " +
81
80
  "and opens a fresh login browser.\n\n" +
82
81
  "Common triggers:\n" +
83
- " • NotebookLM's 50 queries/day free-tier limit is reached and the " +
84
- "user wants to rotate to another Google account\n" +
82
+ " • Google reports an account quota and the user explicitly wants to " +
83
+ "switch to another Google account\n" +
85
84
  " • `setup_auth` failed and a clean slate is needed\n\n" +
86
- "After login, open NotebookLM to verify. For very stuck states, run " +
87
- "`cleanup_data(confirm=true, preserve_library=true)` before `re_auth`.",
85
+ "After login, open NotebookLM to verify. For stuck states, use the " +
86
+ "token-bound preview/confirm workflow of `cleanup_data` before `re_auth`.",
88
87
  inputSchema: {
89
88
  type: "object",
90
89
  properties: {
@@ -112,20 +111,20 @@ export const systemTools = [
112
111
  },
113
112
  {
114
113
  name: "cleanup_data",
115
- description: "Two-phase deep cleanup of all server data on disk (auth state, " +
116
- "browser profiles, caches, MCP logs, temp backups). Cross-platform " +
117
- "(Linux/macOS/Windows). Always close all Chrome/Chromium instances " +
118
- "first — open browsers can lock files.\n\n" +
114
+ description: "Two-phase cleanup restricted to the configured NOTEBOOKLM_DATA_DIR. " +
115
+ "It never scans or deletes npm caches, Claude/Cursor/VS Code data, " +
116
+ "system temporary files, or trash. Close active browser sessions first.\n\n" +
119
117
  "Phase 1 (preview): call with `confirm: false`. Returns a categorised " +
120
- "list of paths and total size. **No deletion happens.**\n" +
118
+ "list, digest, expiry, and one-time preview token. No deletion happens.\n" +
121
119
  "Phase 2 (delete): after the user reviews the preview and approves, " +
122
- "call with `confirm: true`.\n\n" +
120
+ "call with `confirm: true` and the exact `preview_token`. The operation " +
121
+ "is rejected if the token expired or the path manifest changed.\n\n" +
123
122
  "Set `preserve_library: true` to keep the notebook library file " +
124
123
  "(library.json) while wiping everything else — recommended when " +
125
124
  "troubleshooting auth.\n\n" +
126
125
  "Typical recovery flow:\n" +
127
126
  " 1. cleanup_data(confirm=false, preserve_library=true) // preview\n" +
128
- " 2. cleanup_data(confirm=true, preserve_library=true) // execute\n" +
127
+ " 2. cleanup_data(confirm=true, preview_token=...) // execute\n" +
129
128
  " 3. setup_auth (or re_auth)",
130
129
  inputSchema: {
131
130
  type: "object",
@@ -141,6 +140,11 @@ export const systemTools = [
141
140
  "Default: false. Set true when only auth/browser state is broken.",
142
141
  default: false,
143
142
  },
143
+ preview_token: {
144
+ type: "string",
145
+ description: "One-time token returned by the immediately preceding preview. " +
146
+ "Required when confirm=true and valid for five minutes.",
147
+ },
144
148
  },
145
149
  required: ["confirm"],
146
150
  },
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/tools/definitions/system.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,kCAAkC;YAClC,sEAAsE;YACtE,4EAA4E;YAC5E,wEAAwE;YACxE,sEAAsE;YACtE,yDAAyD;YACzD,wCAAwC;YACxC,sEAAsE;YACtE,0EAA0E;YAC1E,oEAAoE;YACpE,qEAAqE;YACrE,yEAAyE;YACzE,qEAAqE;QACvE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB;YAC1B,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,KAAK;SACrB;KACF;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,yEAAyE;YACzE,wEAAwE;YACxE,wEAAwE;YACxE,sEAAsE;YACtE,gBAAgB;YAChB,yDAAyD;YACzD,iDAAiD;YACjD,qEAAqE;YACrE,2CAA2C;YAC3C,0EAA0E;YAC1E,qEAAqE;YACrE,2EAA2E;YAC3E,sEAAsE;YACtE,qBAAqB;QACvB,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,YAAY,EAAE;oBACZ,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,iEAAiE;wBACjE,iEAAiE;iBACpE;gBACD,eAAe,EAAE;oBACf,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,8DAA8D;wBAC9D,yCAAyC;oBAC3C,UAAU,EAAE;wBACV,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;wBACzB,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;wBAC7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OAAO,EAAE;oBACP,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,+DAA+D;wBAC/D,4BAA4B;iBAC/B;gBACD,gBAAgB,EAAE;oBAChB,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,6DAA6D;wBAC7D,kEAAkE;oBACpE,OAAO,EAAE,KAAK;iBACf;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,kBAAkB;YACzB,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/tools/definitions/system.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,kCAAkC;YAClC,sEAAsE;YACtE,4EAA4E;YAC5E,wEAAwE;YACxE,sEAAsE;YACtE,yDAAyD;YACzD,wCAAwC;YACxC,sEAAsE;YACtE,0EAA0E;YAC1E,oEAAoE;YACpE,qEAAqE;YACrE,yEAAyE;YACzE,qEAAqE;QACvE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;QACD,WAAW,EAAE;YACX,KAAK,EAAE,mBAAmB;YAC1B,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,KAAK;SACrB;KACF;IACD;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,yEAAyE;YACzE,qEAAqE;YACrE,qDAAqD;YACrD,sEAAsE;YACtE,gBAAgB;YAChB,yDAAyD;YACzD,iDAAiD;YACjD,sEAAsE;YACtE,0EAA0E;YAC1E,qEAAqE;YACrE,qEAAqE;YACrE,wEAAwE;YACxE,0DAA0D;QAC5D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBAC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c;QACpB,WAAW,EACT,sEAAsE;YACtE,oEAAoE;YACpE,4EAA4E;YAC5E,uEAAuE;YACvE,0EAA0E;YAC1E,qEAAqE;YACrE,yEAAyE;YACzE,oEAAoE;YACpE,iEAAiE;YACjE,iEAAiE;YACjE,2BAA2B;YAC3B,0BAA0B;YAC1B,uEAAuE;YACvE,wEAAwE;YACxE,8BAA8B;QAChC,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,+DAA+D;wBAC/D,4BAA4B;iBAC/B;gBACD,gBAAgB,EAAE;oBAChB,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,6DAA6D;wBAC7D,kEAAkE;oBACpE,OAAO,EAAE,KAAK;iBACf;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,gEAAgE;wBAChE,wDAAwD;iBAC3D;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,kBAAkB;YACzB,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,IAAI;YACpB,aAAa,EAAE,KAAK;SACrB;KACF;CACF,CAAC"}
@@ -4,9 +4,9 @@
4
4
  * Aggregates tool definitions from sub-modules.
5
5
  */
6
6
  import type { Tool } from "@modelcontextprotocol/sdk/types.js";
7
- import type { NotebookLibrary } from "../library/notebook-library.js";
8
7
  /**
9
- * Build Tool Definitions with NotebookLibrary context
8
+ * Build static tool definitions. User-controlled notebook metadata is returned
9
+ * as data by notebook tools and is never embedded in trusted descriptions.
10
10
  */
11
- export declare function buildToolDefinitions(library: NotebookLibrary): Tool[];
11
+ export declare function buildToolDefinitions(): Tool[];
12
12
  //# sourceMappingURL=definitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAOtE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,EAAE,CAcrE"}
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAO/D;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,EAAE,CAQ7C"}
@@ -3,22 +3,18 @@
3
3
  *
4
4
  * Aggregates tool definitions from sub-modules.
5
5
  */
6
- import { askQuestionTool, buildAskQuestionDescription } from "./definitions/ask-question.js";
6
+ import { askQuestionTool } from "./definitions/ask-question.js";
7
7
  import { notebookManagementTools } from "./definitions/notebook-management.js";
8
8
  import { sessionManagementTools } from "./definitions/session-management.js";
9
9
  import { systemTools } from "./definitions/system.js";
10
10
  import { sourceTools } from "./definitions/sources.js";
11
11
  /**
12
- * Build Tool Definitions with NotebookLibrary context
12
+ * Build static tool definitions. User-controlled notebook metadata is returned
13
+ * as data by notebook tools and is never embedded in trusted descriptions.
13
14
  */
14
- export function buildToolDefinitions(library) {
15
- // Update the description for ask_question based on the library state
16
- const dynamicAskQuestionTool = {
17
- ...askQuestionTool,
18
- description: buildAskQuestionDescription(library),
19
- };
15
+ export function buildToolDefinitions() {
20
16
  return [
21
- dynamicAskQuestionTool,
17
+ askQuestionTool,
22
18
  ...notebookManagementTools,
23
19
  ...sessionManagementTools,
24
20
  ...systemTools,
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAwB;IAC3D,qEAAqE;IACrE,MAAM,sBAAsB,GAAG;QAC7B,GAAG,eAAe;QAClB,WAAW,EAAE,2BAA2B,CAAC,OAAO,CAAC;KAClD,CAAC;IAEF,OAAO;QACL,sBAAsB;QACtB,GAAG,uBAAuB;QAC1B,GAAG,sBAAsB;QACzB,GAAG,WAAW;QACd,GAAG,WAAW;KACf,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,eAAe;QACf,GAAG,uBAAuB;QAC1B,GAAG,sBAAsB;QACzB,GAAG,WAAW;QACd,GAAG,WAAW;KACf,CAAC;AACJ,CAAC"}
@@ -6,11 +6,12 @@
6
6
  import type { SessionManager, AccountNotebookSummary } from "../session/session-manager.js";
7
7
  import type { AuthManager } from "../auth/auth-manager.js";
8
8
  import type { NotebookLibrary } from "../library/notebook-library.js";
9
- import type { AddNotebookInput, LibraryStats, NotebookEntry, UpdateNotebookInput } from "../library/types.js";
10
- import type { AddSourceResult } from "../notebooklm/sources.js";
9
+ import type { AddNotebookInput, LibraryStats, NotebookEntry, UpdateNotebookInput, LibrarySyncResult } from "../library/types.js";
10
+ import type { AddSourceInput, AddSourceResult, SourceSummary } from "../notebooklm/sources.js";
11
11
  import type { AudioGenerationResult, DownloadAudioResult } from "../notebooklm/audio.js";
12
12
  import { type BrowserOptions } from "../config.js";
13
13
  import type { AskQuestionResult, ToolResult, ProgressCallback } from "../types.js";
14
+ import { ArtifactStore, type ArtifactJob, type ArtifactType } from "../notebooklm/artifact-store.js";
14
15
  /**
15
16
  * MCP Tool Handlers
16
17
  */
@@ -18,7 +19,10 @@ export declare class ToolHandlers {
18
19
  private sessionManager;
19
20
  private authManager;
20
21
  private library;
21
- constructor(sessionManager: SessionManager, authManager: AuthManager, library: NotebookLibrary);
22
+ private cleanupManager;
23
+ private ownerId;
24
+ private artifactStore;
25
+ constructor(sessionManager: SessionManager, authManager: AuthManager, library: NotebookLibrary, ownerId?: string, artifactStore?: ArtifactStore);
22
26
  /**
23
27
  * Handle ask_question tool
24
28
  */
@@ -30,7 +34,7 @@ export declare class ToolHandlers {
30
34
  show_browser?: boolean;
31
35
  browser_options?: BrowserOptions;
32
36
  source_format?: "none" | "inline" | "footnotes" | "json";
33
- }, sendProgress?: ProgressCallback): Promise<ToolResult<AskQuestionResult>>;
37
+ }, sendProgress?: ProgressCallback, signal?: AbortSignal): Promise<ToolResult<AskQuestionResult>>;
34
38
  /**
35
39
  * Handle list_sessions tool
36
40
  */
@@ -65,7 +69,7 @@ export declare class ToolHandlers {
65
69
  */
66
70
  handleResetSession(args: {
67
71
  session_id: string;
68
- }): Promise<ToolResult<{
72
+ }, signal?: AbortSignal): Promise<ToolResult<{
69
73
  status: string;
70
74
  message: string;
71
75
  session_id: string;
@@ -100,7 +104,7 @@ export declare class ToolHandlers {
100
104
  handleSetupAuth(args: {
101
105
  show_browser?: boolean;
102
106
  browser_options?: BrowserOptions;
103
- }, sendProgress?: ProgressCallback): Promise<ToolResult<{
107
+ }, sendProgress?: ProgressCallback, signal?: AbortSignal): Promise<ToolResult<{
104
108
  status: string;
105
109
  message: string;
106
110
  authenticated: boolean;
@@ -119,7 +123,7 @@ export declare class ToolHandlers {
119
123
  handleReAuth(args: {
120
124
  show_browser?: boolean;
121
125
  browser_options?: BrowserOptions;
122
- }, sendProgress?: ProgressCallback): Promise<ToolResult<{
126
+ }, sendProgress?: ProgressCallback, signal?: AbortSignal): Promise<ToolResult<{
123
127
  status: string;
124
128
  message: string;
125
129
  authenticated: boolean;
@@ -140,9 +144,24 @@ export declare class ToolHandlers {
140
144
  /**
141
145
  * Handle list_account_notebooks tool
142
146
  */
143
- handleListAccountNotebooks(): Promise<ToolResult<{
147
+ handleListAccountNotebooks(signal?: AbortSignal): Promise<ToolResult<{
144
148
  notebooks: AccountNotebookSummary[];
145
149
  }>>;
150
+ handleImportAccountNotebook(args: {
151
+ google_notebook_id: string;
152
+ description?: string;
153
+ topics?: string[];
154
+ content_types?: string[];
155
+ use_cases?: string[];
156
+ tags?: string[];
157
+ }, signal?: AbortSignal): Promise<ToolResult<{
158
+ notebook: NotebookEntry;
159
+ }>>;
160
+ handleSyncLibrary(args: {
161
+ apply?: boolean;
162
+ }, signal?: AbortSignal): Promise<ToolResult<{
163
+ sync: LibrarySyncResult;
164
+ }>>;
146
165
  /**
147
166
  * Handle get_notebook tool
148
167
  */
@@ -189,15 +208,19 @@ export declare class ToolHandlers {
189
208
  /**
190
209
  * Handle cleanup_data tool
191
210
  *
192
- * ULTRATHINK Deep Cleanup - scans entire system for ALL NotebookLM MCP files
211
+ * Constrained, token-bound cleanup of NOTEBOOKLM_DATA_DIR only.
193
212
  */
194
213
  handleCleanupData(args: {
195
214
  confirm: boolean;
196
215
  preserve_library?: boolean;
216
+ preview_token?: string;
197
217
  }): Promise<ToolResult<{
198
218
  status: string;
199
219
  mode: string;
200
220
  preview?: {
221
+ preview_token: string;
222
+ expires_at: string;
223
+ path_digest: string;
201
224
  categories: Array<{
202
225
  name: string;
203
226
  description: string;
@@ -227,16 +250,80 @@ export declare class ToolHandlers {
227
250
  * Handle add_source tool (issue #25).
228
251
  */
229
252
  handleAddSource(args: {
230
- type: "url" | "text";
253
+ type: "url" | "text" | "youtube";
231
254
  content: string;
232
255
  title?: string;
233
256
  session_id?: string;
234
257
  notebook_id?: string;
235
258
  notebook_url?: string;
236
259
  show_browser?: boolean;
237
- }): Promise<ToolResult<{
260
+ }, signal?: AbortSignal): Promise<ToolResult<{
238
261
  result: AddSourceResult;
239
262
  }>>;
263
+ handleListSources(args: {
264
+ session_id?: string;
265
+ notebook_id?: string;
266
+ notebook_url?: string;
267
+ show_browser?: boolean;
268
+ }, signal?: AbortSignal): Promise<ToolResult<{
269
+ sources: SourceSummary[];
270
+ count: number;
271
+ }>>;
272
+ handleGetSource(args: {
273
+ source_id?: string;
274
+ name?: string;
275
+ session_id?: string;
276
+ notebook_id?: string;
277
+ notebook_url?: string;
278
+ show_browser?: boolean;
279
+ }, signal?: AbortSignal): Promise<ToolResult<{
280
+ source: SourceSummary;
281
+ }>>;
282
+ handleBatchAddSources(args: {
283
+ sources: AddSourceInput[];
284
+ stop_on_error?: boolean;
285
+ session_id?: string;
286
+ notebook_id?: string;
287
+ notebook_url?: string;
288
+ show_browser?: boolean;
289
+ }, signal?: AbortSignal): Promise<ToolResult<{
290
+ results: AddSourceResult[];
291
+ added: number;
292
+ failed: number;
293
+ }>>;
294
+ handleGenerateArtifact(args: {
295
+ type: ArtifactType;
296
+ custom_prompt?: string;
297
+ wait_for_completion?: boolean;
298
+ timeout_ms?: number;
299
+ session_id?: string;
300
+ notebook_id?: string;
301
+ notebook_url?: string;
302
+ show_browser?: boolean;
303
+ }, signal?: AbortSignal): Promise<ToolResult<{
304
+ job: ArtifactJob;
305
+ }>>;
306
+ handleListArtifacts(args: {
307
+ notebook_id?: string;
308
+ notebook_url?: string;
309
+ }): Promise<ToolResult<{
310
+ artifacts: ArtifactJob[];
311
+ }>>;
312
+ handleGetArtifactStatus(args: {
313
+ job_id: string;
314
+ show_browser?: boolean;
315
+ }, signal?: AbortSignal): Promise<ToolResult<{
316
+ job: ArtifactJob;
317
+ }>>;
318
+ handleDownloadArtifact(args: {
319
+ job_id: string;
320
+ destination_dir: string;
321
+ show_browser?: boolean;
322
+ }, signal?: AbortSignal): Promise<ToolResult<{
323
+ job: ArtifactJob;
324
+ result: DownloadAudioResult;
325
+ }>>;
326
+ private notebookKey;
240
327
  /**
241
328
  * Handle generate_audio tool (issue #11).
242
329
  */
@@ -248,7 +335,7 @@ export declare class ToolHandlers {
248
335
  notebook_id?: string;
249
336
  notebook_url?: string;
250
337
  show_browser?: boolean;
251
- }): Promise<ToolResult<{
338
+ }, signal?: AbortSignal): Promise<ToolResult<{
252
339
  result: AudioGenerationResult;
253
340
  }>>;
254
341
  /**
@@ -259,7 +346,7 @@ export declare class ToolHandlers {
259
346
  notebook_id?: string;
260
347
  notebook_url?: string;
261
348
  show_browser?: boolean;
262
- }): Promise<ToolResult<{
349
+ }, signal?: AbortSignal): Promise<ToolResult<{
263
350
  result: AudioGenerationResult;
264
351
  }>>;
265
352
  /**
@@ -271,7 +358,7 @@ export declare class ToolHandlers {
271
358
  notebook_id?: string;
272
359
  notebook_url?: string;
273
360
  show_browser?: boolean;
274
- }): Promise<ToolResult<{
361
+ }, signal?: AbortSignal): Promise<ToolResult<{
275
362
  result: DownloadAudioResult;
276
363
  }>>;
277
364
  /**