google-mcp-suite 0.0.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 (528) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +17 -0
  3. package/README.md +80 -0
  4. package/dist/auth/config.d.ts +24 -0
  5. package/dist/auth/config.d.ts.map +1 -0
  6. package/dist/auth/config.js +98 -0
  7. package/dist/auth/config.js.map +1 -0
  8. package/dist/auth/oauth.d.ts +21 -0
  9. package/dist/auth/oauth.d.ts.map +1 -0
  10. package/dist/auth/oauth.js +92 -0
  11. package/dist/auth/oauth.js.map +1 -0
  12. package/dist/doctor/accounts.d.ts +13 -0
  13. package/dist/doctor/accounts.d.ts.map +1 -0
  14. package/dist/doctor/accounts.js +61 -0
  15. package/dist/doctor/accounts.js.map +1 -0
  16. package/dist/doctor/auth.d.ts +16 -0
  17. package/dist/doctor/auth.d.ts.map +1 -0
  18. package/dist/doctor/auth.js +44 -0
  19. package/dist/doctor/auth.js.map +1 -0
  20. package/dist/doctor/browser.d.ts +22 -0
  21. package/dist/doctor/browser.d.ts.map +1 -0
  22. package/dist/doctor/browser.js +44 -0
  23. package/dist/doctor/browser.js.map +1 -0
  24. package/dist/doctor/diagnose.d.ts +10 -0
  25. package/dist/doctor/diagnose.d.ts.map +1 -0
  26. package/dist/doctor/diagnose.js +107 -0
  27. package/dist/doctor/diagnose.js.map +1 -0
  28. package/dist/doctor/index.d.ts +3 -0
  29. package/dist/doctor/index.d.ts.map +1 -0
  30. package/dist/doctor/index.js +59 -0
  31. package/dist/doctor/index.js.map +1 -0
  32. package/dist/doctor/services.d.ts +24 -0
  33. package/dist/doctor/services.d.ts.map +1 -0
  34. package/dist/doctor/services.js +75 -0
  35. package/dist/doctor/services.js.map +1 -0
  36. package/dist/doctor/status.d.ts +18 -0
  37. package/dist/doctor/status.d.ts.map +1 -0
  38. package/dist/doctor/status.js +90 -0
  39. package/dist/doctor/status.js.map +1 -0
  40. package/dist/gmail/capabilities.d.ts +3 -0
  41. package/dist/gmail/capabilities.d.ts.map +1 -0
  42. package/dist/gmail/capabilities.js +21 -0
  43. package/dist/gmail/capabilities.js.map +1 -0
  44. package/dist/gmail/entities/Draft.d.ts +33 -0
  45. package/dist/gmail/entities/Draft.d.ts.map +1 -0
  46. package/dist/gmail/entities/Draft.js +27 -0
  47. package/dist/gmail/entities/Draft.js.map +1 -0
  48. package/dist/gmail/entities/EmailAddress.d.ts +17 -0
  49. package/dist/gmail/entities/EmailAddress.d.ts.map +1 -0
  50. package/dist/gmail/entities/EmailAddress.js +19 -0
  51. package/dist/gmail/entities/EmailAddress.js.map +1 -0
  52. package/dist/gmail/entities/Filter.d.ts +33 -0
  53. package/dist/gmail/entities/Filter.d.ts.map +1 -0
  54. package/dist/gmail/entities/Filter.js +20 -0
  55. package/dist/gmail/entities/Filter.js.map +1 -0
  56. package/dist/gmail/entities/FilterAction.d.ts +9 -0
  57. package/dist/gmail/entities/FilterAction.d.ts.map +1 -0
  58. package/dist/gmail/entities/FilterAction.js +14 -0
  59. package/dist/gmail/entities/FilterAction.js.map +1 -0
  60. package/dist/gmail/entities/FilterCriteria.d.ts +15 -0
  61. package/dist/gmail/entities/FilterCriteria.d.ts.map +1 -0
  62. package/dist/gmail/entities/FilterCriteria.js +17 -0
  63. package/dist/gmail/entities/FilterCriteria.js.map +1 -0
  64. package/dist/gmail/entities/Label.d.ts +28 -0
  65. package/dist/gmail/entities/Label.d.ts.map +1 -0
  66. package/dist/gmail/entities/Label.js +25 -0
  67. package/dist/gmail/entities/Label.js.map +1 -0
  68. package/dist/gmail/entities/LabelColor.d.ts +8 -0
  69. package/dist/gmail/entities/LabelColor.d.ts.map +1 -0
  70. package/dist/gmail/entities/LabelColor.js +9 -0
  71. package/dist/gmail/entities/LabelColor.js.map +1 -0
  72. package/dist/gmail/entities/Message.d.ts +34 -0
  73. package/dist/gmail/entities/Message.d.ts.map +1 -0
  74. package/dist/gmail/entities/Message.js +37 -0
  75. package/dist/gmail/entities/Message.js.map +1 -0
  76. package/dist/gmail/entities/Thread.d.ts +38 -0
  77. package/dist/gmail/entities/Thread.d.ts.map +1 -0
  78. package/dist/gmail/entities/Thread.js +24 -0
  79. package/dist/gmail/entities/Thread.js.map +1 -0
  80. package/dist/gmail/index.d.ts +3 -0
  81. package/dist/gmail/index.d.ts.map +1 -0
  82. package/dist/gmail/index.js +19 -0
  83. package/dist/gmail/index.js.map +1 -0
  84. package/dist/gmail/lib/filter.d.ts +5 -0
  85. package/dist/gmail/lib/filter.d.ts.map +1 -0
  86. package/dist/gmail/lib/filter.js +23 -0
  87. package/dist/gmail/lib/filter.js.map +1 -0
  88. package/dist/gmail/lib/headers.d.ts +6 -0
  89. package/dist/gmail/lib/headers.d.ts.map +1 -0
  90. package/dist/gmail/lib/headers.js +19 -0
  91. package/dist/gmail/lib/headers.js.map +1 -0
  92. package/dist/gmail/lib/label.d.ts +5 -0
  93. package/dist/gmail/lib/label.d.ts.map +1 -0
  94. package/dist/gmail/lib/label.js +16 -0
  95. package/dist/gmail/lib/label.js.map +1 -0
  96. package/dist/gmail/lib/message.d.ts +35 -0
  97. package/dist/gmail/lib/message.d.ts.map +1 -0
  98. package/dist/gmail/lib/message.js +193 -0
  99. package/dist/gmail/lib/message.js.map +1 -0
  100. package/dist/gmail/lib/profile.d.ts +3 -0
  101. package/dist/gmail/lib/profile.d.ts.map +1 -0
  102. package/dist/gmail/lib/profile.js +17 -0
  103. package/dist/gmail/lib/profile.js.map +1 -0
  104. package/dist/gmail/methods/batch_delete_messages/handler.d.ts +5 -0
  105. package/dist/gmail/methods/batch_delete_messages/handler.d.ts.map +1 -0
  106. package/dist/gmail/methods/batch_delete_messages/handler.js +8 -0
  107. package/dist/gmail/methods/batch_delete_messages/handler.js.map +1 -0
  108. package/dist/gmail/methods/batch_delete_messages/index.d.ts +12 -0
  109. package/dist/gmail/methods/batch_delete_messages/index.d.ts.map +1 -0
  110. package/dist/gmail/methods/batch_delete_messages/index.js +16 -0
  111. package/dist/gmail/methods/batch_delete_messages/index.js.map +1 -0
  112. package/dist/gmail/methods/batch_delete_messages/schema.d.ts +12 -0
  113. package/dist/gmail/methods/batch_delete_messages/schema.d.ts.map +1 -0
  114. package/dist/gmail/methods/batch_delete_messages/schema.js +12 -0
  115. package/dist/gmail/methods/batch_delete_messages/schema.js.map +1 -0
  116. package/dist/gmail/methods/batch_modify_messages/handler.d.ts +5 -0
  117. package/dist/gmail/methods/batch_modify_messages/handler.d.ts.map +1 -0
  118. package/dist/gmail/methods/batch_modify_messages/handler.js +17 -0
  119. package/dist/gmail/methods/batch_modify_messages/handler.js.map +1 -0
  120. package/dist/gmail/methods/batch_modify_messages/index.d.ts +14 -0
  121. package/dist/gmail/methods/batch_modify_messages/index.d.ts.map +1 -0
  122. package/dist/gmail/methods/batch_modify_messages/index.js +13 -0
  123. package/dist/gmail/methods/batch_modify_messages/index.js.map +1 -0
  124. package/dist/gmail/methods/batch_modify_messages/schema.d.ts +15 -0
  125. package/dist/gmail/methods/batch_modify_messages/schema.d.ts.map +1 -0
  126. package/dist/gmail/methods/batch_modify_messages/schema.js +15 -0
  127. package/dist/gmail/methods/batch_modify_messages/schema.js.map +1 -0
  128. package/dist/gmail/methods/create_filter/handler.d.ts +5 -0
  129. package/dist/gmail/methods/create_filter/handler.d.ts.map +1 -0
  130. package/dist/gmail/methods/create_filter/handler.js +10 -0
  131. package/dist/gmail/methods/create_filter/handler.js.map +1 -0
  132. package/dist/gmail/methods/create_filter/index.d.ts +38 -0
  133. package/dist/gmail/methods/create_filter/index.d.ts.map +1 -0
  134. package/dist/gmail/methods/create_filter/index.js +14 -0
  135. package/dist/gmail/methods/create_filter/index.js.map +1 -0
  136. package/dist/gmail/methods/create_filter/schema.d.ts +42 -0
  137. package/dist/gmail/methods/create_filter/schema.d.ts.map +1 -0
  138. package/dist/gmail/methods/create_filter/schema.js +13 -0
  139. package/dist/gmail/methods/create_filter/schema.js.map +1 -0
  140. package/dist/gmail/methods/delete_draft/handler.d.ts +5 -0
  141. package/dist/gmail/methods/delete_draft/handler.d.ts.map +1 -0
  142. package/dist/gmail/methods/delete_draft/handler.js +5 -0
  143. package/dist/gmail/methods/delete_draft/handler.js.map +1 -0
  144. package/dist/gmail/methods/delete_draft/index.d.ts +10 -0
  145. package/dist/gmail/methods/delete_draft/index.d.ts.map +1 -0
  146. package/dist/gmail/methods/delete_draft/index.js +13 -0
  147. package/dist/gmail/methods/delete_draft/index.js.map +1 -0
  148. package/dist/gmail/methods/delete_draft/schema.d.ts +12 -0
  149. package/dist/gmail/methods/delete_draft/schema.d.ts.map +1 -0
  150. package/dist/gmail/methods/delete_draft/schema.js +12 -0
  151. package/dist/gmail/methods/delete_draft/schema.js.map +1 -0
  152. package/dist/gmail/methods/delete_filter/handler.d.ts +5 -0
  153. package/dist/gmail/methods/delete_filter/handler.d.ts.map +1 -0
  154. package/dist/gmail/methods/delete_filter/handler.js +5 -0
  155. package/dist/gmail/methods/delete_filter/handler.js.map +1 -0
  156. package/dist/gmail/methods/delete_filter/index.d.ts +10 -0
  157. package/dist/gmail/methods/delete_filter/index.d.ts.map +1 -0
  158. package/dist/gmail/methods/delete_filter/index.js +13 -0
  159. package/dist/gmail/methods/delete_filter/index.js.map +1 -0
  160. package/dist/gmail/methods/delete_filter/schema.d.ts +12 -0
  161. package/dist/gmail/methods/delete_filter/schema.d.ts.map +1 -0
  162. package/dist/gmail/methods/delete_filter/schema.js +12 -0
  163. package/dist/gmail/methods/delete_filter/schema.js.map +1 -0
  164. package/dist/gmail/methods/delete_label/handler.d.ts +5 -0
  165. package/dist/gmail/methods/delete_label/handler.d.ts.map +1 -0
  166. package/dist/gmail/methods/delete_label/handler.js +5 -0
  167. package/dist/gmail/methods/delete_label/handler.js.map +1 -0
  168. package/dist/gmail/methods/delete_label/index.d.ts +11 -0
  169. package/dist/gmail/methods/delete_label/index.d.ts.map +1 -0
  170. package/dist/gmail/methods/delete_label/index.js +14 -0
  171. package/dist/gmail/methods/delete_label/index.js.map +1 -0
  172. package/dist/gmail/methods/delete_label/schema.d.ts +12 -0
  173. package/dist/gmail/methods/delete_label/schema.d.ts.map +1 -0
  174. package/dist/gmail/methods/delete_label/schema.js +12 -0
  175. package/dist/gmail/methods/delete_label/schema.js.map +1 -0
  176. package/dist/gmail/methods/delete_message/handler.d.ts +5 -0
  177. package/dist/gmail/methods/delete_message/handler.d.ts.map +1 -0
  178. package/dist/gmail/methods/delete_message/handler.js +5 -0
  179. package/dist/gmail/methods/delete_message/handler.js.map +1 -0
  180. package/dist/gmail/methods/delete_message/index.d.ts +12 -0
  181. package/dist/gmail/methods/delete_message/index.d.ts.map +1 -0
  182. package/dist/gmail/methods/delete_message/index.js +16 -0
  183. package/dist/gmail/methods/delete_message/index.js.map +1 -0
  184. package/dist/gmail/methods/delete_message/schema.d.ts +11 -0
  185. package/dist/gmail/methods/delete_message/schema.d.ts.map +1 -0
  186. package/dist/gmail/methods/delete_message/schema.js +11 -0
  187. package/dist/gmail/methods/delete_message/schema.js.map +1 -0
  188. package/dist/gmail/methods/delete_thread/handler.d.ts +5 -0
  189. package/dist/gmail/methods/delete_thread/handler.d.ts.map +1 -0
  190. package/dist/gmail/methods/delete_thread/handler.js +5 -0
  191. package/dist/gmail/methods/delete_thread/handler.js.map +1 -0
  192. package/dist/gmail/methods/delete_thread/index.d.ts +12 -0
  193. package/dist/gmail/methods/delete_thread/index.d.ts.map +1 -0
  194. package/dist/gmail/methods/delete_thread/index.js +16 -0
  195. package/dist/gmail/methods/delete_thread/index.js.map +1 -0
  196. package/dist/gmail/methods/delete_thread/schema.d.ts +12 -0
  197. package/dist/gmail/methods/delete_thread/schema.d.ts.map +1 -0
  198. package/dist/gmail/methods/delete_thread/schema.js +12 -0
  199. package/dist/gmail/methods/delete_thread/schema.js.map +1 -0
  200. package/dist/gmail/methods/download_attachment/handler.d.ts +5 -0
  201. package/dist/gmail/methods/download_attachment/handler.d.ts.map +1 -0
  202. package/dist/gmail/methods/download_attachment/handler.js +13 -0
  203. package/dist/gmail/methods/download_attachment/handler.js.map +1 -0
  204. package/dist/gmail/methods/download_attachment/index.d.ts +13 -0
  205. package/dist/gmail/methods/download_attachment/index.d.ts.map +1 -0
  206. package/dist/gmail/methods/download_attachment/index.js +13 -0
  207. package/dist/gmail/methods/download_attachment/index.js.map +1 -0
  208. package/dist/gmail/methods/download_attachment/schema.d.ts +14 -0
  209. package/dist/gmail/methods/download_attachment/schema.d.ts.map +1 -0
  210. package/dist/gmail/methods/download_attachment/schema.js +15 -0
  211. package/dist/gmail/methods/download_attachment/schema.js.map +1 -0
  212. package/dist/gmail/methods/get_draft/handler.d.ts +5 -0
  213. package/dist/gmail/methods/get_draft/handler.d.ts.map +1 -0
  214. package/dist/gmail/methods/get_draft/handler.js +10 -0
  215. package/dist/gmail/methods/get_draft/handler.js.map +1 -0
  216. package/dist/gmail/methods/get_draft/index.d.ts +24 -0
  217. package/dist/gmail/methods/get_draft/index.d.ts.map +1 -0
  218. package/dist/gmail/methods/get_draft/index.js +10 -0
  219. package/dist/gmail/methods/get_draft/index.js.map +1 -0
  220. package/dist/gmail/methods/get_draft/schema.d.ts +28 -0
  221. package/dist/gmail/methods/get_draft/schema.d.ts.map +1 -0
  222. package/dist/gmail/methods/get_draft/schema.js +10 -0
  223. package/dist/gmail/methods/get_draft/schema.js.map +1 -0
  224. package/dist/gmail/methods/get_filter/handler.d.ts +5 -0
  225. package/dist/gmail/methods/get_filter/handler.d.ts.map +1 -0
  226. package/dist/gmail/methods/get_filter/handler.js +6 -0
  227. package/dist/gmail/methods/get_filter/handler.js.map +1 -0
  228. package/dist/gmail/methods/get_filter/index.d.ts +23 -0
  229. package/dist/gmail/methods/get_filter/index.d.ts.map +1 -0
  230. package/dist/gmail/methods/get_filter/index.js +10 -0
  231. package/dist/gmail/methods/get_filter/index.js.map +1 -0
  232. package/dist/gmail/methods/get_filter/schema.d.ts +27 -0
  233. package/dist/gmail/methods/get_filter/schema.d.ts.map +1 -0
  234. package/dist/gmail/methods/get_filter/schema.js +10 -0
  235. package/dist/gmail/methods/get_filter/schema.js.map +1 -0
  236. package/dist/gmail/methods/get_label/handler.d.ts +5 -0
  237. package/dist/gmail/methods/get_label/handler.d.ts.map +1 -0
  238. package/dist/gmail/methods/get_label/handler.js +6 -0
  239. package/dist/gmail/methods/get_label/handler.js.map +1 -0
  240. package/dist/gmail/methods/get_label/index.d.ts +17 -0
  241. package/dist/gmail/methods/get_label/index.d.ts.map +1 -0
  242. package/dist/gmail/methods/get_label/index.js +13 -0
  243. package/dist/gmail/methods/get_label/index.js.map +1 -0
  244. package/dist/gmail/methods/get_label/schema.d.ts +18 -0
  245. package/dist/gmail/methods/get_label/schema.d.ts.map +1 -0
  246. package/dist/gmail/methods/get_label/schema.js +10 -0
  247. package/dist/gmail/methods/get_label/schema.js.map +1 -0
  248. package/dist/gmail/methods/get_message/handler.d.ts +5 -0
  249. package/dist/gmail/methods/get_message/handler.d.ts.map +1 -0
  250. package/dist/gmail/methods/get_message/handler.js +7 -0
  251. package/dist/gmail/methods/get_message/handler.js.map +1 -0
  252. package/dist/gmail/methods/get_message/index.d.ts +34 -0
  253. package/dist/gmail/methods/get_message/index.d.ts.map +1 -0
  254. package/dist/gmail/methods/get_message/index.js +14 -0
  255. package/dist/gmail/methods/get_message/index.js.map +1 -0
  256. package/dist/gmail/methods/get_message/schema.d.ts +34 -0
  257. package/dist/gmail/methods/get_message/schema.d.ts.map +1 -0
  258. package/dist/gmail/methods/get_message/schema.js +11 -0
  259. package/dist/gmail/methods/get_message/schema.js.map +1 -0
  260. package/dist/gmail/methods/list_filters/handler.d.ts +5 -0
  261. package/dist/gmail/methods/list_filters/handler.d.ts.map +1 -0
  262. package/dist/gmail/methods/list_filters/handler.js +6 -0
  263. package/dist/gmail/methods/list_filters/handler.js.map +1 -0
  264. package/dist/gmail/methods/list_filters/index.d.ts +23 -0
  265. package/dist/gmail/methods/list_filters/index.d.ts.map +1 -0
  266. package/dist/gmail/methods/list_filters/index.js +10 -0
  267. package/dist/gmail/methods/list_filters/index.js.map +1 -0
  268. package/dist/gmail/methods/list_filters/schema.d.ts +27 -0
  269. package/dist/gmail/methods/list_filters/schema.d.ts.map +1 -0
  270. package/dist/gmail/methods/list_filters/schema.js +10 -0
  271. package/dist/gmail/methods/list_filters/schema.js.map +1 -0
  272. package/dist/gmail/methods/list_messages/handler.d.ts +5 -0
  273. package/dist/gmail/methods/list_messages/handler.d.ts.map +1 -0
  274. package/dist/gmail/methods/list_messages/handler.js +18 -0
  275. package/dist/gmail/methods/list_messages/handler.js.map +1 -0
  276. package/dist/gmail/methods/list_messages/index.d.ts +35 -0
  277. package/dist/gmail/methods/list_messages/index.d.ts.map +1 -0
  278. package/dist/gmail/methods/list_messages/index.js +14 -0
  279. package/dist/gmail/methods/list_messages/index.js.map +1 -0
  280. package/dist/gmail/methods/list_messages/schema.d.ts +35 -0
  281. package/dist/gmail/methods/list_messages/schema.d.ts.map +1 -0
  282. package/dist/gmail/methods/list_messages/schema.js +17 -0
  283. package/dist/gmail/methods/list_messages/schema.js.map +1 -0
  284. package/dist/gmail/methods/registry.d.ts +423 -0
  285. package/dist/gmail/methods/registry.d.ts.map +1 -0
  286. package/dist/gmail/methods/registry.js +60 -0
  287. package/dist/gmail/methods/registry.js.map +1 -0
  288. package/dist/gmail/methods/send_draft/handler.d.ts +5 -0
  289. package/dist/gmail/methods/send_draft/handler.d.ts.map +1 -0
  290. package/dist/gmail/methods/send_draft/handler.js +9 -0
  291. package/dist/gmail/methods/send_draft/handler.js.map +1 -0
  292. package/dist/gmail/methods/send_draft/index.d.ts +30 -0
  293. package/dist/gmail/methods/send_draft/index.d.ts.map +1 -0
  294. package/dist/gmail/methods/send_draft/index.js +16 -0
  295. package/dist/gmail/methods/send_draft/index.js.map +1 -0
  296. package/dist/gmail/methods/send_draft/schema.d.ts +30 -0
  297. package/dist/gmail/methods/send_draft/schema.d.ts.map +1 -0
  298. package/dist/gmail/methods/send_draft/schema.js +11 -0
  299. package/dist/gmail/methods/send_draft/schema.js.map +1 -0
  300. package/dist/gmail/methods/send_message/handler.d.ts +5 -0
  301. package/dist/gmail/methods/send_message/handler.d.ts.map +1 -0
  302. package/dist/gmail/methods/send_message/handler.js +19 -0
  303. package/dist/gmail/methods/send_message/handler.js.map +1 -0
  304. package/dist/gmail/methods/send_message/index.d.ts +37 -0
  305. package/dist/gmail/methods/send_message/index.d.ts.map +1 -0
  306. package/dist/gmail/methods/send_message/index.js +17 -0
  307. package/dist/gmail/methods/send_message/index.js.map +1 -0
  308. package/dist/gmail/methods/send_message/schema.d.ts +35 -0
  309. package/dist/gmail/methods/send_message/schema.d.ts.map +1 -0
  310. package/dist/gmail/methods/send_message/schema.js +17 -0
  311. package/dist/gmail/methods/send_message/schema.js.map +1 -0
  312. package/dist/gmail/methods/trash_message/handler.d.ts +5 -0
  313. package/dist/gmail/methods/trash_message/handler.d.ts.map +1 -0
  314. package/dist/gmail/methods/trash_message/handler.js +6 -0
  315. package/dist/gmail/methods/trash_message/handler.js.map +1 -0
  316. package/dist/gmail/methods/trash_message/index.d.ts +28 -0
  317. package/dist/gmail/methods/trash_message/index.d.ts.map +1 -0
  318. package/dist/gmail/methods/trash_message/index.js +13 -0
  319. package/dist/gmail/methods/trash_message/index.js.map +1 -0
  320. package/dist/gmail/methods/trash_message/schema.d.ts +29 -0
  321. package/dist/gmail/methods/trash_message/schema.d.ts.map +1 -0
  322. package/dist/gmail/methods/trash_message/schema.js +10 -0
  323. package/dist/gmail/methods/trash_message/schema.js.map +1 -0
  324. package/dist/gmail/methods/trash_thread/handler.d.ts +5 -0
  325. package/dist/gmail/methods/trash_thread/handler.d.ts.map +1 -0
  326. package/dist/gmail/methods/trash_thread/handler.js +6 -0
  327. package/dist/gmail/methods/trash_thread/handler.js.map +1 -0
  328. package/dist/gmail/methods/trash_thread/index.d.ts +32 -0
  329. package/dist/gmail/methods/trash_thread/index.d.ts.map +1 -0
  330. package/dist/gmail/methods/trash_thread/index.js +13 -0
  331. package/dist/gmail/methods/trash_thread/index.js.map +1 -0
  332. package/dist/gmail/methods/trash_thread/schema.d.ts +33 -0
  333. package/dist/gmail/methods/trash_thread/schema.d.ts.map +1 -0
  334. package/dist/gmail/methods/trash_thread/schema.js +10 -0
  335. package/dist/gmail/methods/trash_thread/schema.js.map +1 -0
  336. package/dist/gmail/methods/untrash_message/handler.d.ts +5 -0
  337. package/dist/gmail/methods/untrash_message/handler.d.ts.map +1 -0
  338. package/dist/gmail/methods/untrash_message/handler.js +6 -0
  339. package/dist/gmail/methods/untrash_message/handler.js.map +1 -0
  340. package/dist/gmail/methods/untrash_message/index.d.ts +28 -0
  341. package/dist/gmail/methods/untrash_message/index.d.ts.map +1 -0
  342. package/dist/gmail/methods/untrash_message/index.js +13 -0
  343. package/dist/gmail/methods/untrash_message/index.js.map +1 -0
  344. package/dist/gmail/methods/untrash_message/schema.d.ts +29 -0
  345. package/dist/gmail/methods/untrash_message/schema.d.ts.map +1 -0
  346. package/dist/gmail/methods/untrash_message/schema.js +10 -0
  347. package/dist/gmail/methods/untrash_message/schema.js.map +1 -0
  348. package/dist/gmail/methods/untrash_thread/handler.d.ts +5 -0
  349. package/dist/gmail/methods/untrash_thread/handler.d.ts.map +1 -0
  350. package/dist/gmail/methods/untrash_thread/handler.js +6 -0
  351. package/dist/gmail/methods/untrash_thread/handler.js.map +1 -0
  352. package/dist/gmail/methods/untrash_thread/index.d.ts +32 -0
  353. package/dist/gmail/methods/untrash_thread/index.d.ts.map +1 -0
  354. package/dist/gmail/methods/untrash_thread/index.js +13 -0
  355. package/dist/gmail/methods/untrash_thread/index.js.map +1 -0
  356. package/dist/gmail/methods/untrash_thread/schema.d.ts +33 -0
  357. package/dist/gmail/methods/untrash_thread/schema.d.ts.map +1 -0
  358. package/dist/gmail/methods/untrash_thread/schema.js +10 -0
  359. package/dist/gmail/methods/untrash_thread/schema.js.map +1 -0
  360. package/dist/gmail/methods/update_draft/handler.d.ts +5 -0
  361. package/dist/gmail/methods/update_draft/handler.d.ts.map +1 -0
  362. package/dist/gmail/methods/update_draft/handler.js +25 -0
  363. package/dist/gmail/methods/update_draft/handler.js.map +1 -0
  364. package/dist/gmail/methods/update_draft/index.d.ts +34 -0
  365. package/dist/gmail/methods/update_draft/index.d.ts.map +1 -0
  366. package/dist/gmail/methods/update_draft/index.js +14 -0
  367. package/dist/gmail/methods/update_draft/index.js.map +1 -0
  368. package/dist/gmail/methods/update_draft/schema.d.ts +34 -0
  369. package/dist/gmail/methods/update_draft/schema.d.ts.map +1 -0
  370. package/dist/gmail/methods/update_draft/schema.js +17 -0
  371. package/dist/gmail/methods/update_draft/schema.js.map +1 -0
  372. package/dist/gmail/methods/update_label/handler.d.ts +5 -0
  373. package/dist/gmail/methods/update_label/handler.d.ts.map +1 -0
  374. package/dist/gmail/methods/update_label/handler.js +11 -0
  375. package/dist/gmail/methods/update_label/handler.js.map +1 -0
  376. package/dist/gmail/methods/update_label/index.d.ts +22 -0
  377. package/dist/gmail/methods/update_label/index.d.ts.map +1 -0
  378. package/dist/gmail/methods/update_label/index.js +13 -0
  379. package/dist/gmail/methods/update_label/index.js.map +1 -0
  380. package/dist/gmail/methods/update_label/schema.d.ts +23 -0
  381. package/dist/gmail/methods/update_label/schema.d.ts.map +1 -0
  382. package/dist/gmail/methods/update_label/schema.js +13 -0
  383. package/dist/gmail/methods/update_label/schema.js.map +1 -0
  384. package/dist/gmail/operation.d.ts +12 -0
  385. package/dist/gmail/operation.d.ts.map +1 -0
  386. package/dist/gmail/operation.js +10 -0
  387. package/dist/gmail/operation.js.map +1 -0
  388. package/dist/gmail/tools/create_draft/handler.d.ts +5 -0
  389. package/dist/gmail/tools/create_draft/handler.d.ts.map +1 -0
  390. package/dist/gmail/tools/create_draft/handler.js +23 -0
  391. package/dist/gmail/tools/create_draft/handler.js.map +1 -0
  392. package/dist/gmail/tools/create_draft/index.d.ts +36 -0
  393. package/dist/gmail/tools/create_draft/index.d.ts.map +1 -0
  394. package/dist/gmail/tools/create_draft/index.js +16 -0
  395. package/dist/gmail/tools/create_draft/index.js.map +1 -0
  396. package/dist/gmail/tools/create_draft/schema.d.ts +34 -0
  397. package/dist/gmail/tools/create_draft/schema.d.ts.map +1 -0
  398. package/dist/gmail/tools/create_draft/schema.js +17 -0
  399. package/dist/gmail/tools/create_draft/schema.js.map +1 -0
  400. package/dist/gmail/tools/create_label/handler.d.ts +5 -0
  401. package/dist/gmail/tools/create_label/handler.d.ts.map +1 -0
  402. package/dist/gmail/tools/create_label/handler.js +10 -0
  403. package/dist/gmail/tools/create_label/handler.js.map +1 -0
  404. package/dist/gmail/tools/create_label/index.d.ts +23 -0
  405. package/dist/gmail/tools/create_label/index.d.ts.map +1 -0
  406. package/dist/gmail/tools/create_label/index.js +15 -0
  407. package/dist/gmail/tools/create_label/index.js.map +1 -0
  408. package/dist/gmail/tools/create_label/schema.d.ts +22 -0
  409. package/dist/gmail/tools/create_label/schema.d.ts.map +1 -0
  410. package/dist/gmail/tools/create_label/schema.js +12 -0
  411. package/dist/gmail/tools/create_label/schema.js.map +1 -0
  412. package/dist/gmail/tools/get_thread/handler.d.ts +5 -0
  413. package/dist/gmail/tools/get_thread/handler.d.ts.map +1 -0
  414. package/dist/gmail/tools/get_thread/handler.js +14 -0
  415. package/dist/gmail/tools/get_thread/handler.js.map +1 -0
  416. package/dist/gmail/tools/get_thread/index.d.ts +40 -0
  417. package/dist/gmail/tools/get_thread/index.d.ts.map +1 -0
  418. package/dist/gmail/tools/get_thread/index.js +16 -0
  419. package/dist/gmail/tools/get_thread/index.js.map +1 -0
  420. package/dist/gmail/tools/get_thread/schema.d.ts +38 -0
  421. package/dist/gmail/tools/get_thread/schema.d.ts.map +1 -0
  422. package/dist/gmail/tools/get_thread/schema.js +11 -0
  423. package/dist/gmail/tools/get_thread/schema.js.map +1 -0
  424. package/dist/gmail/tools/label_message/handler.d.ts +5 -0
  425. package/dist/gmail/tools/label_message/handler.d.ts.map +1 -0
  426. package/dist/gmail/tools/label_message/handler.js +9 -0
  427. package/dist/gmail/tools/label_message/handler.js.map +1 -0
  428. package/dist/gmail/tools/label_message/index.d.ts +14 -0
  429. package/dist/gmail/tools/label_message/index.d.ts.map +1 -0
  430. package/dist/gmail/tools/label_message/index.js +15 -0
  431. package/dist/gmail/tools/label_message/index.js.map +1 -0
  432. package/dist/gmail/tools/label_message/schema.d.ts +14 -0
  433. package/dist/gmail/tools/label_message/schema.d.ts.map +1 -0
  434. package/dist/gmail/tools/label_message/schema.js +14 -0
  435. package/dist/gmail/tools/label_message/schema.js.map +1 -0
  436. package/dist/gmail/tools/label_thread/handler.d.ts +5 -0
  437. package/dist/gmail/tools/label_thread/handler.d.ts.map +1 -0
  438. package/dist/gmail/tools/label_thread/handler.js +9 -0
  439. package/dist/gmail/tools/label_thread/handler.js.map +1 -0
  440. package/dist/gmail/tools/label_thread/index.d.ts +13 -0
  441. package/dist/gmail/tools/label_thread/index.d.ts.map +1 -0
  442. package/dist/gmail/tools/label_thread/index.js +14 -0
  443. package/dist/gmail/tools/label_thread/index.js.map +1 -0
  444. package/dist/gmail/tools/label_thread/schema.d.ts +14 -0
  445. package/dist/gmail/tools/label_thread/schema.d.ts.map +1 -0
  446. package/dist/gmail/tools/label_thread/schema.js +14 -0
  447. package/dist/gmail/tools/label_thread/schema.js.map +1 -0
  448. package/dist/gmail/tools/list_drafts/handler.d.ts +5 -0
  449. package/dist/gmail/tools/list_drafts/handler.d.ts.map +1 -0
  450. package/dist/gmail/tools/list_drafts/handler.js +17 -0
  451. package/dist/gmail/tools/list_drafts/handler.js.map +1 -0
  452. package/dist/gmail/tools/list_drafts/index.d.ts +34 -0
  453. package/dist/gmail/tools/list_drafts/index.d.ts.map +1 -0
  454. package/dist/gmail/tools/list_drafts/index.js +15 -0
  455. package/dist/gmail/tools/list_drafts/index.js.map +1 -0
  456. package/dist/gmail/tools/list_drafts/schema.d.ts +33 -0
  457. package/dist/gmail/tools/list_drafts/schema.d.ts.map +1 -0
  458. package/dist/gmail/tools/list_drafts/schema.js +16 -0
  459. package/dist/gmail/tools/list_drafts/schema.js.map +1 -0
  460. package/dist/gmail/tools/list_labels/handler.d.ts +5 -0
  461. package/dist/gmail/tools/list_labels/handler.d.ts.map +1 -0
  462. package/dist/gmail/tools/list_labels/handler.js +6 -0
  463. package/dist/gmail/tools/list_labels/handler.js.map +1 -0
  464. package/dist/gmail/tools/list_labels/index.d.ts +24 -0
  465. package/dist/gmail/tools/list_labels/index.d.ts.map +1 -0
  466. package/dist/gmail/tools/list_labels/index.js +16 -0
  467. package/dist/gmail/tools/list_labels/index.js.map +1 -0
  468. package/dist/gmail/tools/list_labels/schema.d.ts +22 -0
  469. package/dist/gmail/tools/list_labels/schema.d.ts.map +1 -0
  470. package/dist/gmail/tools/list_labels/schema.js +14 -0
  471. package/dist/gmail/tools/list_labels/schema.js.map +1 -0
  472. package/dist/gmail/tools/registry.d.ts +188 -0
  473. package/dist/gmail/tools/registry.d.ts.map +1 -0
  474. package/dist/gmail/tools/registry.js +27 -0
  475. package/dist/gmail/tools/registry.js.map +1 -0
  476. package/dist/gmail/tools/search_threads/handler.d.ts +5 -0
  477. package/dist/gmail/tools/search_threads/handler.d.ts.map +1 -0
  478. package/dist/gmail/tools/search_threads/handler.js +17 -0
  479. package/dist/gmail/tools/search_threads/handler.js.map +1 -0
  480. package/dist/gmail/tools/search_threads/index.d.ts +41 -0
  481. package/dist/gmail/tools/search_threads/index.d.ts.map +1 -0
  482. package/dist/gmail/tools/search_threads/index.js +16 -0
  483. package/dist/gmail/tools/search_threads/index.js.map +1 -0
  484. package/dist/gmail/tools/search_threads/schema.d.ts +39 -0
  485. package/dist/gmail/tools/search_threads/schema.d.ts.map +1 -0
  486. package/dist/gmail/tools/search_threads/schema.js +16 -0
  487. package/dist/gmail/tools/search_threads/schema.js.map +1 -0
  488. package/dist/gmail/tools/unlabel_message/handler.d.ts +5 -0
  489. package/dist/gmail/tools/unlabel_message/handler.d.ts.map +1 -0
  490. package/dist/gmail/tools/unlabel_message/handler.js +9 -0
  491. package/dist/gmail/tools/unlabel_message/handler.js.map +1 -0
  492. package/dist/gmail/tools/unlabel_message/index.d.ts +14 -0
  493. package/dist/gmail/tools/unlabel_message/index.d.ts.map +1 -0
  494. package/dist/gmail/tools/unlabel_message/index.js +15 -0
  495. package/dist/gmail/tools/unlabel_message/index.js.map +1 -0
  496. package/dist/gmail/tools/unlabel_message/schema.d.ts +14 -0
  497. package/dist/gmail/tools/unlabel_message/schema.d.ts.map +1 -0
  498. package/dist/gmail/tools/unlabel_message/schema.js +14 -0
  499. package/dist/gmail/tools/unlabel_message/schema.js.map +1 -0
  500. package/dist/gmail/tools/unlabel_thread/handler.d.ts +5 -0
  501. package/dist/gmail/tools/unlabel_thread/handler.d.ts.map +1 -0
  502. package/dist/gmail/tools/unlabel_thread/handler.js +9 -0
  503. package/dist/gmail/tools/unlabel_thread/handler.js.map +1 -0
  504. package/dist/gmail/tools/unlabel_thread/index.d.ts +13 -0
  505. package/dist/gmail/tools/unlabel_thread/index.d.ts.map +1 -0
  506. package/dist/gmail/tools/unlabel_thread/index.js +14 -0
  507. package/dist/gmail/tools/unlabel_thread/index.js.map +1 -0
  508. package/dist/gmail/tools/unlabel_thread/schema.d.ts +14 -0
  509. package/dist/gmail/tools/unlabel_thread/schema.d.ts.map +1 -0
  510. package/dist/gmail/tools/unlabel_thread/schema.js +14 -0
  511. package/dist/gmail/tools/unlabel_thread/schema.js.map +1 -0
  512. package/dist/lib/google.d.ts +27 -0
  513. package/dist/lib/google.d.ts.map +1 -0
  514. package/dist/lib/google.js +4 -0
  515. package/dist/lib/google.js.map +1 -0
  516. package/dist/lib/operation.d.ts +51 -0
  517. package/dist/lib/operation.d.ts.map +1 -0
  518. package/dist/lib/operation.js +26 -0
  519. package/dist/lib/operation.js.map +1 -0
  520. package/dist/lib/server.d.ts +61 -0
  521. package/dist/lib/server.d.ts.map +1 -0
  522. package/dist/lib/server.js +100 -0
  523. package/dist/lib/server.js.map +1 -0
  524. package/dist/lib/types.d.ts +13 -0
  525. package/dist/lib/types.d.ts.map +1 -0
  526. package/dist/lib/types.js +2 -0
  527. package/dist/lib/types.js.map +1 -0
  528. package/package.json +78 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_message/handler.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,KAAqB,EACrB,IAAkC;IAElC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;QACjD,MAAM,EAAE,IAAI;QACZ,EAAE,EAAE,IAAI,CAAC,SAAS;QAClB,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE;KAC/C,CAAC,CAAC;IACH,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC3E,CAAC","sourcesContent":["import type { gmail_v1 } from '@googleapis/gmail';\nimport type { z } from 'zod';\nimport type { schema } from './schema.js';\n\nexport async function handler(\n gmail: gmail_v1.Gmail,\n args: z.infer<typeof schema.input>,\n): Promise<z.infer<typeof schema.output>> {\n const { data } = await gmail.users.messages.modify({\n userId: 'me',\n id: args.messageId,\n requestBody: { removeLabelIds: args.labelIds },\n });\n return { messageId: data.id ?? args.messageId, labelIds: args.labelIds };\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_message
3
+ * Removes labels via `users.messages.modify` (removeLabelIds); confirms the
4
+ * removed labels. (Matches `unlabel_thread`, whose thread response carries no
5
+ * single label set, so both tools report the labels acted on.)
6
+ */
7
+ export declare const unlabel_message: import("../../../lib/operation.js").Operation<import("@googleapis/gmail").gmail_v1.Gmail, import("zod").ZodObject<{
8
+ messageId: import("zod").ZodString;
9
+ labelIds: import("zod").ZodArray<import("zod").ZodString>;
10
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
11
+ messageId: import("zod").ZodString;
12
+ labelIds: import("zod").ZodArray<import("zod").ZodString>;
13
+ }, import("zod/v4/core").$strip>>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_message/index.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;iCAI1B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { gmailOperation } from '../../operation.js';
2
+ import { handler } from './handler.js';
3
+ import { schema } from './schema.js';
4
+ /**
5
+ * Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_message
6
+ * Removes labels via `users.messages.modify` (removeLabelIds); confirms the
7
+ * removed labels. (Matches `unlabel_thread`, whose thread response carries no
8
+ * single label set, so both tools report the labels acted on.)
9
+ */
10
+ export const unlabel_message = gmailOperation({
11
+ description: 'Remove labels from a message.',
12
+ schema,
13
+ handler,
14
+ });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;IAC5C,WAAW,EAAE,+BAA+B;IAC5C,MAAM;IACN,OAAO;CACR,CAAC,CAAC","sourcesContent":["import { gmailOperation } from '../../operation.js';\nimport { handler } from './handler.js';\nimport { schema } from './schema.js';\n\n/**\n * Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_message\n * Removes labels via `users.messages.modify` (removeLabelIds); confirms the\n * removed labels. (Matches `unlabel_thread`, whose thread response carries no\n * single label set, so both tools report the labels acted on.)\n */\nexport const unlabel_message = gmailOperation({\n description: 'Remove labels from a message.',\n schema,\n handler,\n});\n"]}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /** Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_message */
3
+ export declare const schema: {
4
+ input: z.ZodObject<{
5
+ messageId: z.ZodString;
6
+ labelIds: z.ZodArray<z.ZodString>;
7
+ }, z.core.$strip>;
8
+ /** The MCP reference documents no output body; we confirm the removed labels. */
9
+ output: z.ZodObject<{
10
+ messageId: z.ZodString;
11
+ labelIds: z.ZodArray<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ };
14
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_message/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yGAAyG;AACzG,eAAO,MAAM,MAAM;;;;;IAKjB,iFAAiF;;;;;CAKlF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /** Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_message */
3
+ export const schema = {
4
+ input: z.object({
5
+ messageId: z.string().describe('The id of the message to remove the labels from.'),
6
+ labelIds: z.array(z.string()).describe('The ids of the labels to remove.'),
7
+ }),
8
+ /** The MCP reference documents no output body; we confirm the removed labels. */
9
+ output: z.object({
10
+ messageId: z.string(),
11
+ labelIds: z.array(z.string()),
12
+ }),
13
+ };
14
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_message/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yGAAyG;AACzG,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;QAClF,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KAC3E,CAAC;IACF,iFAAiF;IACjF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC","sourcesContent":["import { z } from 'zod';\n\n/** Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_message */\nexport const schema = {\n input: z.object({\n messageId: z.string().describe('The id of the message to remove the labels from.'),\n labelIds: z.array(z.string()).describe('The ids of the labels to remove.'),\n }),\n /** The MCP reference documents no output body; we confirm the removed labels. */\n output: z.object({\n messageId: z.string(),\n labelIds: z.array(z.string()),\n }),\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import type { gmail_v1 } from '@googleapis/gmail';
2
+ import type { z } from 'zod';
3
+ import type { schema } from './schema.js';
4
+ export declare function handler(gmail: gmail_v1.Gmail, args: z.infer<typeof schema.input>): Promise<z.infer<typeof schema.output>>;
5
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_thread/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,wBAAsB,OAAO,CAC3B,KAAK,EAAE,QAAQ,CAAC,KAAK,EACrB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,GACjC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAOxC"}
@@ -0,0 +1,9 @@
1
+ export async function handler(gmail, args) {
2
+ const { data } = await gmail.users.threads.modify({
3
+ userId: 'me',
4
+ id: args.threadId,
5
+ requestBody: { removeLabelIds: args.labelIds },
6
+ });
7
+ return { threadId: data.id ?? args.threadId, labelIds: args.labelIds };
8
+ }
9
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_thread/handler.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,KAAqB,EACrB,IAAkC;IAElC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAChD,MAAM,EAAE,IAAI;QACZ,EAAE,EAAE,IAAI,CAAC,QAAQ;QACjB,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE;KAC/C,CAAC,CAAC;IACH,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;AACzE,CAAC","sourcesContent":["import type { gmail_v1 } from '@googleapis/gmail';\nimport type { z } from 'zod';\nimport type { schema } from './schema.js';\n\nexport async function handler(\n gmail: gmail_v1.Gmail,\n args: z.infer<typeof schema.input>,\n): Promise<z.infer<typeof schema.output>> {\n const { data } = await gmail.users.threads.modify({\n userId: 'me',\n id: args.threadId,\n requestBody: { removeLabelIds: args.labelIds },\n });\n return { threadId: data.id ?? args.threadId, labelIds: args.labelIds };\n}\n"]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_thread
3
+ * Removes labels from every message in a thread via `users.threads.modify`
4
+ * (removeLabelIds); confirms the removed labels.
5
+ */
6
+ export declare const unlabel_thread: import("../../../lib/operation.js").Operation<import("@googleapis/gmail").gmail_v1.Gmail, import("zod").ZodObject<{
7
+ threadId: import("zod").ZodString;
8
+ labelIds: import("zod").ZodArray<import("zod").ZodString>;
9
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
10
+ threadId: import("zod").ZodString;
11
+ labelIds: import("zod").ZodArray<import("zod").ZodString>;
12
+ }, import("zod/v4/core").$strip>>;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_thread/index.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,cAAc;;;;;;iCAIzB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { gmailOperation } from '../../operation.js';
2
+ import { handler } from './handler.js';
3
+ import { schema } from './schema.js';
4
+ /**
5
+ * Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_thread
6
+ * Removes labels from every message in a thread via `users.threads.modify`
7
+ * (removeLabelIds); confirms the removed labels.
8
+ */
9
+ export const unlabel_thread = gmailOperation({
10
+ description: 'Remove labels from a thread.',
11
+ schema,
12
+ handler,
13
+ });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_thread/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC;IAC3C,WAAW,EAAE,8BAA8B;IAC3C,MAAM;IACN,OAAO;CACR,CAAC,CAAC","sourcesContent":["import { gmailOperation } from '../../operation.js';\nimport { handler } from './handler.js';\nimport { schema } from './schema.js';\n\n/**\n * Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_thread\n * Removes labels from every message in a thread via `users.threads.modify`\n * (removeLabelIds); confirms the removed labels.\n */\nexport const unlabel_thread = gmailOperation({\n description: 'Remove labels from a thread.',\n schema,\n handler,\n});\n"]}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /** Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_thread */
3
+ export declare const schema: {
4
+ input: z.ZodObject<{
5
+ threadId: z.ZodString;
6
+ labelIds: z.ZodArray<z.ZodString>;
7
+ }, z.core.$strip>;
8
+ /** The MCP reference documents no output body; we confirm the removed labels. */
9
+ output: z.ZodObject<{
10
+ threadId: z.ZodString;
11
+ labelIds: z.ZodArray<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ };
14
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_thread/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wGAAwG;AACxG,eAAO,MAAM,MAAM;;;;;IAKjB,iFAAiF;;;;;CAKlF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ /** Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_thread */
3
+ export const schema = {
4
+ input: z.object({
5
+ threadId: z.string().describe('The id of the thread to remove the labels from.'),
6
+ labelIds: z.array(z.string()).describe('The ids of the labels to remove.'),
7
+ }),
8
+ /** The MCP reference documents no output body; we confirm the removed labels. */
9
+ output: z.object({
10
+ threadId: z.string(),
11
+ labelIds: z.array(z.string()),
12
+ }),
13
+ };
14
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/gmail/tools/unlabel_thread/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wGAAwG;AACxG,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;QAChF,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;KAC3E,CAAC;IACF,iFAAiF;IACjF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH,CAAC","sourcesContent":["import { z } from 'zod';\n\n/** Source: https://developers.google.com/workspace/gmail/api/reference/mcp/tools_list/unlabel_thread */\nexport const schema = {\n input: z.object({\n threadId: z.string().describe('The id of the thread to remove the labels from.'),\n labelIds: z.array(z.string()).describe('The ids of the labels to remove.'),\n }),\n /** The MCP reference documents no output body; we confirm the removed labels. */\n output: z.object({\n threadId: z.string(),\n labelIds: z.array(z.string()),\n }),\n};\n"]}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The single boundary between our `exactOptionalPropertyTypes`-strict code and
3
+ * Google's API types.
4
+ *
5
+ * Google's generated types model an optional field as `field?: T` (the value
6
+ * never includes `undefined`). Our code models optionality explicitly as
7
+ * `field?: Optional<T>` (`T | undefined`). Under `exactOptionalPropertyTypes`
8
+ * those are incompatible: an object literal that carries `field: T | undefined`
9
+ * cannot be passed where `field?: T` is expected.
10
+ *
11
+ * `forGoogle` is the one place that reconciles the two. It drops every
12
+ * `undefined`-valued key, and its return type proves they are gone, so the
13
+ * mismatch is resolved here and nowhere else, with no suppression. Everywhere
14
+ * else in the codebase stays fully strict.
15
+ *
16
+ * There is no behavioral change: `JSON.stringify` omits `undefined` keys and
17
+ * gaxios drops `undefined` query params, so what reaches Google is identical
18
+ * whether a key is absent or present-and-undefined. This adapter only makes the
19
+ * types say what already happens at runtime.
20
+ */
21
+ export type ForGoogle<T> = {
22
+ [K in keyof T as undefined extends T[K] ? never : K]: T[K];
23
+ } & {
24
+ [K in keyof T as undefined extends T[K] ? K : never]?: Exclude<T[K], undefined>;
25
+ };
26
+ export declare function forGoogle<T extends object>(params: T): ForGoogle<T>;
27
+ //# sourceMappingURL=google.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../src/lib/google.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG;KACzF,CAAC,IAAI,MAAM,CAAC,IAAI,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;CAChF,CAAC;AAEF,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAInE"}
@@ -0,0 +1,4 @@
1
+ export function forGoogle(params) {
2
+ return Object.fromEntries(Object.entries(params).filter(([, value]) => value !== undefined));
3
+ }
4
+ //# sourceMappingURL=google.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.js","sourceRoot":"","sources":["../../src/lib/google.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,SAAS,CAAmB,MAAS;IACnD,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAClD,CAAC;AACpB,CAAC","sourcesContent":["/**\n * The single boundary between our `exactOptionalPropertyTypes`-strict code and\n * Google's API types.\n *\n * Google's generated types model an optional field as `field?: T` (the value\n * never includes `undefined`). Our code models optionality explicitly as\n * `field?: Optional<T>` (`T | undefined`). Under `exactOptionalPropertyTypes`\n * those are incompatible: an object literal that carries `field: T | undefined`\n * cannot be passed where `field?: T` is expected.\n *\n * `forGoogle` is the one place that reconciles the two. It drops every\n * `undefined`-valued key, and its return type proves they are gone, so the\n * mismatch is resolved here and nowhere else, with no suppression. Everywhere\n * else in the codebase stays fully strict.\n *\n * There is no behavioral change: `JSON.stringify` omits `undefined` keys and\n * gaxios drops `undefined` query params, so what reaches Google is identical\n * whether a key is absent or present-and-undefined. This adapter only makes the\n * types say what already happens at runtime.\n */\nexport type ForGoogle<T> = { [K in keyof T as undefined extends T[K] ? never : K]: T[K] } & {\n [K in keyof T as undefined extends T[K] ? K : never]?: Exclude<T[K], undefined>;\n};\n\nexport function forGoogle<T extends object>(params: T): ForGoogle<T> {\n return Object.fromEntries(\n Object.entries(params).filter(([, value]) => value !== undefined),\n ) as ForGoogle<T>;\n}\n"]}
@@ -0,0 +1,51 @@
1
+ import type { z } from 'zod';
2
+ /**
3
+ * A single operation: its documented I/O contract plus the work that fulfills it.
4
+ * Every tool and method is an `Operation`; they differ only by which Google
5
+ * reference the folder mirrors (MCP toolset vs REST), never by type.
6
+ *
7
+ * `schema` is the contract (zod, mirrored from the docs); `handler` receives the
8
+ * service's authenticated client and the validated input and returns a value that
9
+ * conforms to `schema.output`.
10
+ */
11
+ export type Operation<Client, In extends z.ZodType, Out extends z.ZodType> = {
12
+ description: string;
13
+ schema: {
14
+ input: In;
15
+ output: Out;
16
+ };
17
+ handler: (client: Client, args: z.infer<In>) => Promise<z.infer<Out>>;
18
+ /** Irreversible (send, permanent delete) or a standing side effect (a forwarding filter); surfaced as MCP `destructiveHint`. */
19
+ destructive?: boolean;
20
+ };
21
+ /**
22
+ * An operation with its schemas erased; the shape the registry and server hold.
23
+ * The handler's args are widened to `never` so any concrete `Operation` is
24
+ * assignable here (a handler taking a specific input is assignable to one taking
25
+ * `never` by contravariance; under zod 4, `z.infer<z.ZodType>` is `unknown`, which
26
+ * would break that, so `never` restores it).
27
+ */
28
+ export type AnyOperation<Client> = {
29
+ description: string;
30
+ schema: {
31
+ input: z.ZodType;
32
+ output: z.ZodType;
33
+ };
34
+ handler: (client: Client, args: never) => Promise<unknown>;
35
+ destructive?: boolean;
36
+ };
37
+ /**
38
+ * Define an operation. A no-op at runtime (it returns its argument); its job is
39
+ * type inference — `Client` from the handler's first parameter, `input`/`output`
40
+ * from `schema` — and the front-door check that the handler consumes exactly what
41
+ * the schema declares.
42
+ */
43
+ export declare const operation: <Client, In extends z.ZodType, Out extends z.ZodType>(def: Operation<Client, In, Out>) => Operation<Client, In, Out>;
44
+ /**
45
+ * Merge operation groups (e.g. a service's tools and methods) into the single
46
+ * registry the server dispatches. Throws on a duplicate wire name: two operations
47
+ * cannot answer to the same key, and a silent `{ ...a, ...b }` spread would let
48
+ * one shadow the other and vanish from the wire with no error.
49
+ */
50
+ export declare function mergeOperations<Client>(...groups: Record<string, AnyOperation<Client>>[]): Record<string, AnyOperation<Client>>;
51
+ //# sourceMappingURL=operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/lib/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,IAAI;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QAAE,KAAK,EAAE,EAAE,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,CAAC;IACnC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,gIAAgI;IAChI,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CAAC,MAAM,IAAI;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;QAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAA;KAAE,CAAC;IAChD,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,EAAE,EAAE,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,EAC3E,KAAK,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,CAAC,KAC9B,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,CAAQ,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EACpC,GAAG,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,GAChD,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAWtC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Define an operation. A no-op at runtime (it returns its argument); its job is
3
+ * type inference — `Client` from the handler's first parameter, `input`/`output`
4
+ * from `schema` — and the front-door check that the handler consumes exactly what
5
+ * the schema declares.
6
+ */
7
+ export const operation = (def) => def;
8
+ /**
9
+ * Merge operation groups (e.g. a service's tools and methods) into the single
10
+ * registry the server dispatches. Throws on a duplicate wire name: two operations
11
+ * cannot answer to the same key, and a silent `{ ...a, ...b }` spread would let
12
+ * one shadow the other and vanish from the wire with no error.
13
+ */
14
+ export function mergeOperations(...groups) {
15
+ const merged = {};
16
+ for (const group of groups) {
17
+ for (const [name, op] of Object.entries(group)) {
18
+ if (name in merged) {
19
+ throw new Error(`Duplicate operation name: ${name}`);
20
+ }
21
+ merged[name] = op;
22
+ }
23
+ }
24
+ return merged;
25
+ }
26
+ //# sourceMappingURL=operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/lib/operation.ts"],"names":[],"mappings":"AAiCA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,GAA+B,EACH,EAAE,CAAC,GAAG,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAG,MAA8C;IAEjD,MAAM,MAAM,GAAyC,EAAE,CAAC;IACxD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;YACvD,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { z } from 'zod';\n\n/**\n * A single operation: its documented I/O contract plus the work that fulfills it.\n * Every tool and method is an `Operation`; they differ only by which Google\n * reference the folder mirrors (MCP toolset vs REST), never by type.\n *\n * `schema` is the contract (zod, mirrored from the docs); `handler` receives the\n * service's authenticated client and the validated input and returns a value that\n * conforms to `schema.output`.\n */\nexport type Operation<Client, In extends z.ZodType, Out extends z.ZodType> = {\n description: string;\n schema: { input: In; output: Out };\n handler: (client: Client, args: z.infer<In>) => Promise<z.infer<Out>>;\n /** Irreversible (send, permanent delete) or a standing side effect (a forwarding filter); surfaced as MCP `destructiveHint`. */\n destructive?: boolean;\n};\n\n/**\n * An operation with its schemas erased; the shape the registry and server hold.\n * The handler's args are widened to `never` so any concrete `Operation` is\n * assignable here (a handler taking a specific input is assignable to one taking\n * `never` by contravariance; under zod 4, `z.infer<z.ZodType>` is `unknown`, which\n * would break that, so `never` restores it).\n */\nexport type AnyOperation<Client> = {\n description: string;\n schema: { input: z.ZodType; output: z.ZodType };\n handler: (client: Client, args: never) => Promise<unknown>;\n destructive?: boolean;\n};\n\n/**\n * Define an operation. A no-op at runtime (it returns its argument); its job is\n * type inference — `Client` from the handler's first parameter, `input`/`output`\n * from `schema` — and the front-door check that the handler consumes exactly what\n * the schema declares.\n */\nexport const operation = <Client, In extends z.ZodType, Out extends z.ZodType>(\n def: Operation<Client, In, Out>,\n): Operation<Client, In, Out> => def;\n\n/**\n * Merge operation groups (e.g. a service's tools and methods) into the single\n * registry the server dispatches. Throws on a duplicate wire name: two operations\n * cannot answer to the same key, and a silent `{ ...a, ...b }` spread would let\n * one shadow the other and vanish from the wire with no error.\n */\nexport function mergeOperations<Client>(\n ...groups: Record<string, AnyOperation<Client>>[]\n): Record<string, AnyOperation<Client>> {\n const merged: Record<string, AnyOperation<Client>> = {};\n for (const group of groups) {\n for (const [name, op] of Object.entries(group)) {\n if (name in merged) {\n throw new Error(`Duplicate operation name: ${name}`);\n }\n merged[name] = op;\n }\n }\n return merged;\n}\n"]}
@@ -0,0 +1,61 @@
1
+ import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
2
+ import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import type { AnyOperation } from './operation.js';
4
+ export type ServerOptions<Client> = {
5
+ /** MCP server name (the service, e.g. 'gmail'). */
6
+ name: string;
7
+ version?: string;
8
+ /** Every operation this server exposes, keyed by wire name (tools and methods merged). */
9
+ operations: Record<string, AnyOperation<Client>>;
10
+ /** Build the authenticated client for the account this instance is bound to. */
11
+ client: (account: string | undefined) => Promise<Client>;
12
+ /** Optional consent flow, invoked by the `auth` subcommand. */
13
+ runAuth?: (account: string | undefined) => Promise<void>;
14
+ /** Transport to connect; defaults to stdio. Injectable for tests. */
15
+ transport?: Transport;
16
+ };
17
+ /**
18
+ * Build the MCP `tools/list` payload from the operations: each one's input and
19
+ * output JSON Schema, plus a destructive hint for irreversible ops. On the wire,
20
+ * every operation is a "tool" (MCP has no other word). Pure; exported for tests.
21
+ */
22
+ export declare function toolDefinitions<Client>(operations: Record<string, AnyOperation<Client>>): {
23
+ annotations?: {
24
+ destructiveHint: boolean;
25
+ };
26
+ name: string;
27
+ description: string;
28
+ inputSchema: Record<string, unknown>;
29
+ outputSchema: Record<string, unknown>;
30
+ }[];
31
+ /** A labeled set of operations for the capability table: its provenance + the ops. */
32
+ export type CapabilityGroup<Client> = {
33
+ /** Provenance shown in the Source column, e.g. 'MCP Tool' or 'REST Method'. */
34
+ kind: string;
35
+ operations: Record<string, AnyOperation<Client>>;
36
+ };
37
+ /**
38
+ * Render the operations as a Markdown capability table (name, source, description,
39
+ * and an irreversible marker), derived from the same registries the server
40
+ * dispatches. The Source column makes the dual surface explicit: the suite is both
41
+ * an MCP-toolset wrapper and a REST wrapper, because MCP's toolset alone cannot
42
+ * fully drive a service. A static mirror; agents that speak MCP discover the live,
43
+ * fully-schema'd surface via `tools/list`. Pure; a service regenerates its
44
+ * CAPABILITIES.md from this so the doc cannot drift from the code.
45
+ */
46
+ export declare function renderCapabilities<Client>(title: string, groups: CapabilityGroup<Client>[]): string;
47
+ /**
48
+ * Run one operation by name: resolve it, validate input against its schema, run
49
+ * the handler, validate the output, and return both a structured result and a text
50
+ * rendering (for clients that do not yet read `structuredContent`). All failure
51
+ * paths return an `isError` result rather than throwing. Exported for tests.
52
+ */
53
+ export declare function callOperation<Client>(operations: Record<string, AnyOperation<Client>>, client: Client, name: string, rawArgs: unknown): Promise<CallToolResult>;
54
+ /**
55
+ * Turn a service's operations into a running stdio MCP server. Identical for every
56
+ * service; only the bound `Client` type and the operations differ. Owns the
57
+ * cross-cutting concerns: the `auth` subcommand, account binding, the `tools/list`
58
+ * payload, dispatch, validation, and error wrapping.
59
+ */
60
+ export declare function server<Client>(options: ServerOptions<Client>): Promise<void>;
61
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/lib/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI;IAClC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0FAA0F;IAC1F,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,gFAAgF;IAChF,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,qEAAqE;IACrE,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;;;;;;iBAInB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;kBACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAG9F;AAED,sFAAsF;AACtF,MAAM,MAAM,eAAe,CAAC,MAAM,IAAI;IACpC,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;CAClD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EACvC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,GAChC,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,EACxC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,EAChD,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,cAAc,CAAC,CA0BzB;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBlF"}
@@ -0,0 +1,100 @@
1
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
4
+ import { z } from 'zod';
5
+ import pkg from '../../package.json' with { type: 'json' };
6
+ function errorResult(message) {
7
+ return { content: [{ type: 'text', text: `Error: ${message}` }], isError: true };
8
+ }
9
+ /**
10
+ * Build the MCP `tools/list` payload from the operations: each one's input and
11
+ * output JSON Schema, plus a destructive hint for irreversible ops. On the wire,
12
+ * every operation is a "tool" (MCP has no other word). Pure; exported for tests.
13
+ */
14
+ export function toolDefinitions(operations) {
15
+ return Object.entries(operations).map(([name, op]) => ({
16
+ name,
17
+ description: op.description,
18
+ inputSchema: z.toJSONSchema(op.schema.input, { io: 'input' }),
19
+ outputSchema: z.toJSONSchema(op.schema.output, { io: 'output' }),
20
+ ...(op.destructive ? { annotations: { destructiveHint: true } } : {}),
21
+ }));
22
+ }
23
+ /**
24
+ * Render the operations as a Markdown capability table (name, source, description,
25
+ * and an irreversible marker), derived from the same registries the server
26
+ * dispatches. The Source column makes the dual surface explicit: the suite is both
27
+ * an MCP-toolset wrapper and a REST wrapper, because MCP's toolset alone cannot
28
+ * fully drive a service. A static mirror; agents that speak MCP discover the live,
29
+ * fully-schema'd surface via `tools/list`. Pure; a service regenerates its
30
+ * CAPABILITIES.md from this so the doc cannot drift from the code.
31
+ */
32
+ export function renderCapabilities(title, groups) {
33
+ const rows = groups.flatMap(({ kind, operations }) => Object.entries(operations).map(([name, op]) => `| \`${name}\`${op.destructive ? ' ⚠️' : ''} | ${kind} | ${op.description} |`));
34
+ return `${[
35
+ `# ${title}`,
36
+ '',
37
+ `${rows.length} operations across MCP tools and REST methods. ⚠️ marks irreversible operations (MCP \`destructiveHint\`).`,
38
+ '',
39
+ '| Operation | Source | Description |',
40
+ '| --- | --- | --- |',
41
+ ...rows,
42
+ ].join('\n')}\n`;
43
+ }
44
+ /**
45
+ * Run one operation by name: resolve it, validate input against its schema, run
46
+ * the handler, validate the output, and return both a structured result and a text
47
+ * rendering (for clients that do not yet read `structuredContent`). All failure
48
+ * paths return an `isError` result rather than throwing. Exported for tests.
49
+ */
50
+ export async function callOperation(operations, client, name, rawArgs) {
51
+ const op = operations[name];
52
+ if (!op) {
53
+ return errorResult(`Unknown tool: ${name}`);
54
+ }
55
+ const parsed = op.schema.input.safeParse(rawArgs ?? {});
56
+ if (!parsed.success) {
57
+ return errorResult(`Invalid arguments for ${name}: ${parsed.error.message}`);
58
+ }
59
+ try {
60
+ // `parsed.data` was just validated against this op's input schema, so it is
61
+ // the handler's real input shape. The `AnyOperation` boundary types the
62
+ // handler's args as `never` (so any concrete Operation stays assignable; see
63
+ // operation.ts), and `as never` is the only call form. The validation above
64
+ // is what makes this safe: do not call the handler before parsing.
65
+ const result = await op.handler(client, parsed.data);
66
+ const validated = op.schema.output.parse(result);
67
+ return {
68
+ content: [{ type: 'text', text: JSON.stringify(validated, null, 2) }],
69
+ structuredContent: validated,
70
+ };
71
+ }
72
+ catch (error) {
73
+ return errorResult(error instanceof Error ? error.message : String(error));
74
+ }
75
+ }
76
+ /**
77
+ * Turn a service's operations into a running stdio MCP server. Identical for every
78
+ * service; only the bound `Client` type and the operations differ. Owns the
79
+ * cross-cutting concerns: the `auth` subcommand, account binding, the `tools/list`
80
+ * payload, dispatch, validation, and error wrapping.
81
+ */
82
+ export async function server(options) {
83
+ const { name, version = pkg.version, operations, client, runAuth } = options;
84
+ if (process.argv[2] === 'auth') {
85
+ if (!runAuth) {
86
+ console.error(`${name}: no auth flow configured.`);
87
+ process.exit(1);
88
+ }
89
+ await runAuth(process.argv[3] ?? process.env['GOOGLE_MCP_ACCOUNT']);
90
+ process.exit(0);
91
+ }
92
+ const authed = await client(process.env['GOOGLE_MCP_ACCOUNT']);
93
+ const mcp = new Server({ name, version }, { capabilities: { tools: {} } });
94
+ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
95
+ tools: toolDefinitions(operations),
96
+ }));
97
+ mcp.setRequestHandler(CallToolRequestSchema, (request) => callOperation(operations, authed, request.params.name, request.params.arguments));
98
+ await mcp.connect(options.transport ?? new StdioServerTransport());
99
+ }
100
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/lib/server.ts"],"names":[],"mappings":"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","sourcesContent":["import { Server } from '@modelcontextprotocol/sdk/server/index.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';\nimport {\n CallToolRequestSchema,\n type CallToolResult,\n ListToolsRequestSchema,\n} from '@modelcontextprotocol/sdk/types.js';\nimport { z } from 'zod';\nimport pkg from '../../package.json' with { type: 'json' };\nimport type { AnyOperation } from './operation.js';\n\nexport type ServerOptions<Client> = {\n /** MCP server name (the service, e.g. 'gmail'). */\n name: string;\n version?: string;\n /** Every operation this server exposes, keyed by wire name (tools and methods merged). */\n operations: Record<string, AnyOperation<Client>>;\n /** Build the authenticated client for the account this instance is bound to. */\n client: (account: string | undefined) => Promise<Client>;\n /** Optional consent flow, invoked by the `auth` subcommand. */\n runAuth?: (account: string | undefined) => Promise<void>;\n /** Transport to connect; defaults to stdio. Injectable for tests. */\n transport?: Transport;\n};\n\nfunction errorResult(message: string): CallToolResult {\n return { content: [{ type: 'text', text: `Error: ${message}` }], isError: true };\n}\n\n/**\n * Build the MCP `tools/list` payload from the operations: each one's input and\n * output JSON Schema, plus a destructive hint for irreversible ops. On the wire,\n * every operation is a \"tool\" (MCP has no other word). Pure; exported for tests.\n */\nexport function toolDefinitions<Client>(operations: Record<string, AnyOperation<Client>>) {\n return Object.entries(operations).map(([name, op]) => ({\n name,\n description: op.description,\n inputSchema: z.toJSONSchema(op.schema.input, { io: 'input' }) as Record<string, unknown>,\n outputSchema: z.toJSONSchema(op.schema.output, { io: 'output' }) as Record<string, unknown>,\n ...(op.destructive ? { annotations: { destructiveHint: true } } : {}),\n }));\n}\n\n/** A labeled set of operations for the capability table: its provenance + the ops. */\nexport type CapabilityGroup<Client> = {\n /** Provenance shown in the Source column, e.g. 'MCP Tool' or 'REST Method'. */\n kind: string;\n operations: Record<string, AnyOperation<Client>>;\n};\n\n/**\n * Render the operations as a Markdown capability table (name, source, description,\n * and an irreversible marker), derived from the same registries the server\n * dispatches. The Source column makes the dual surface explicit: the suite is both\n * an MCP-toolset wrapper and a REST wrapper, because MCP's toolset alone cannot\n * fully drive a service. A static mirror; agents that speak MCP discover the live,\n * fully-schema'd surface via `tools/list`. Pure; a service regenerates its\n * CAPABILITIES.md from this so the doc cannot drift from the code.\n */\nexport function renderCapabilities<Client>(\n title: string,\n groups: CapabilityGroup<Client>[],\n): string {\n const rows = groups.flatMap(({ kind, operations }) =>\n Object.entries(operations).map(\n ([name, op]) => `| \\`${name}\\`${op.destructive ? ' ⚠️' : ''} | ${kind} | ${op.description} |`,\n ),\n );\n return `${[\n `# ${title}`,\n '',\n `${rows.length} operations across MCP tools and REST methods. ⚠️ marks irreversible operations (MCP \\`destructiveHint\\`).`,\n '',\n '| Operation | Source | Description |',\n '| --- | --- | --- |',\n ...rows,\n ].join('\\n')}\\n`;\n}\n\n/**\n * Run one operation by name: resolve it, validate input against its schema, run\n * the handler, validate the output, and return both a structured result and a text\n * rendering (for clients that do not yet read `structuredContent`). All failure\n * paths return an `isError` result rather than throwing. Exported for tests.\n */\nexport async function callOperation<Client>(\n operations: Record<string, AnyOperation<Client>>,\n client: Client,\n name: string,\n rawArgs: unknown,\n): Promise<CallToolResult> {\n const op = operations[name];\n if (!op) {\n return errorResult(`Unknown tool: ${name}`);\n }\n\n const parsed = op.schema.input.safeParse(rawArgs ?? {});\n if (!parsed.success) {\n return errorResult(`Invalid arguments for ${name}: ${parsed.error.message}`);\n }\n\n try {\n // `parsed.data` was just validated against this op's input schema, so it is\n // the handler's real input shape. The `AnyOperation` boundary types the\n // handler's args as `never` (so any concrete Operation stays assignable; see\n // operation.ts), and `as never` is the only call form. The validation above\n // is what makes this safe: do not call the handler before parsing.\n const result = await op.handler(client, parsed.data as never);\n const validated = op.schema.output.parse(result);\n return {\n content: [{ type: 'text', text: JSON.stringify(validated, null, 2) }],\n structuredContent: validated as Record<string, unknown>,\n };\n } catch (error) {\n return errorResult(error instanceof Error ? error.message : String(error));\n }\n}\n\n/**\n * Turn a service's operations into a running stdio MCP server. Identical for every\n * service; only the bound `Client` type and the operations differ. Owns the\n * cross-cutting concerns: the `auth` subcommand, account binding, the `tools/list`\n * payload, dispatch, validation, and error wrapping.\n */\nexport async function server<Client>(options: ServerOptions<Client>): Promise<void> {\n const { name, version = pkg.version, operations, client, runAuth } = options;\n\n if (process.argv[2] === 'auth') {\n if (!runAuth) {\n console.error(`${name}: no auth flow configured.`);\n process.exit(1);\n }\n await runAuth(process.argv[3] ?? process.env['GOOGLE_MCP_ACCOUNT']);\n process.exit(0);\n }\n\n const authed = await client(process.env['GOOGLE_MCP_ACCOUNT']);\n const mcp = new Server({ name, version }, { capabilities: { tools: {} } });\n\n mcp.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: toolDefinitions(operations),\n }));\n\n mcp.setRequestHandler(CallToolRequestSchema, (request) =>\n callOperation(operations, authed, request.params.name, request.params.arguments),\n );\n\n await mcp.connect(options.transport ?? new StdioServerTransport());\n}\n"]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * An explicitly optional value: `T` or `undefined`.
3
+ *
4
+ * Pair with `?` on a property (`field?: Optional<T>`) so the key may be absent
5
+ * and, under `exactOptionalPropertyTypes`, may also be an explicit `undefined`.
6
+ * We keep optionality explicit in our own types rather than implicit in a bare
7
+ * `?`; the word mirrors Google's field language (its docs mark fields "Optional.").
8
+ *
9
+ * This is a value-type alias, not a property modifier: it complements `?`, it
10
+ * does not replace it.
11
+ */
12
+ export type Optional<T> = T | undefined;
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * An explicitly optional value: `T` or `undefined`.\n *\n * Pair with `?` on a property (`field?: Optional<T>`) so the key may be absent\n * and, under `exactOptionalPropertyTypes`, may also be an explicit `undefined`.\n * We keep optionality explicit in our own types rather than implicit in a bare\n * `?`; the word mirrors Google's field language (its docs mark fields \"Optional.\").\n *\n * This is a value-type alias, not a property modifier: it complements `?`, it\n * does not replace it.\n */\nexport type Optional<T> = T | undefined;\n"]}