@cyanheads/mcp-ts-core 0.1.0-beta.12

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 (485) hide show
  1. package/CLAUDE.md +583 -0
  2. package/LICENSE +201 -0
  3. package/README.md +287 -0
  4. package/biome.json +103 -0
  5. package/dist/app.d.ts +82 -0
  6. package/dist/app.d.ts.map +1 -0
  7. package/dist/app.js +222 -0
  8. package/dist/app.js.map +1 -0
  9. package/dist/cli/init.d.ts +8 -0
  10. package/dist/cli/init.d.ts.map +1 -0
  11. package/dist/cli/init.js +161 -0
  12. package/dist/cli/init.js.map +1 -0
  13. package/dist/config/index.d.ts +349 -0
  14. package/dist/config/index.d.ts.map +1 -0
  15. package/dist/config/index.js +464 -0
  16. package/dist/config/index.js.map +1 -0
  17. package/dist/context.d.ts +119 -0
  18. package/dist/context.d.ts.map +1 -0
  19. package/dist/context.js +144 -0
  20. package/dist/context.js.map +1 -0
  21. package/dist/index.d.ts +8 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +9 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/mcp-server/prompts/prompt-registration.d.ts +33 -0
  26. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -0
  27. package/dist/mcp-server/prompts/prompt-registration.js +91 -0
  28. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -0
  29. package/dist/mcp-server/prompts/utils/newPromptDefinition.d.ts +49 -0
  30. package/dist/mcp-server/prompts/utils/newPromptDefinition.d.ts.map +1 -0
  31. package/dist/mcp-server/prompts/utils/newPromptDefinition.js +39 -0
  32. package/dist/mcp-server/prompts/utils/newPromptDefinition.js.map +1 -0
  33. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +37 -0
  34. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -0
  35. package/dist/mcp-server/prompts/utils/promptDefinition.js +2 -0
  36. package/dist/mcp-server/prompts/utils/promptDefinition.js.map +1 -0
  37. package/dist/mcp-server/resources/resource-registration.d.ts +27 -0
  38. package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -0
  39. package/dist/mcp-server/resources/resource-registration.js +85 -0
  40. package/dist/mcp-server/resources/resource-registration.js.map +1 -0
  41. package/dist/mcp-server/resources/utils/newResourceDefinition.d.ts +84 -0
  42. package/dist/mcp-server/resources/utils/newResourceDefinition.d.ts.map +1 -0
  43. package/dist/mcp-server/resources/utils/newResourceDefinition.js +40 -0
  44. package/dist/mcp-server/resources/utils/newResourceDefinition.js.map +1 -0
  45. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.d.ts +32 -0
  46. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.d.ts.map +1 -0
  47. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.js +103 -0
  48. package/dist/mcp-server/resources/utils/newResourceHandlerFactory.js.map +1 -0
  49. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +94 -0
  50. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -0
  51. package/dist/mcp-server/resources/utils/resourceDefinition.js +2 -0
  52. package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -0
  53. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +14 -0
  54. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -0
  55. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +111 -0
  56. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -0
  57. package/dist/mcp-server/roots/roots-registration.d.ts +22 -0
  58. package/dist/mcp-server/roots/roots-registration.d.ts.map +1 -0
  59. package/dist/mcp-server/roots/roots-registration.js +25 -0
  60. package/dist/mcp-server/roots/roots-registration.js.map +1 -0
  61. package/dist/mcp-server/server.d.ts +34 -0
  62. package/dist/mcp-server/server.d.ts.map +1 -0
  63. package/dist/mcp-server/server.js +62 -0
  64. package/dist/mcp-server/server.js.map +1 -0
  65. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts +42 -0
  66. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts.map +1 -0
  67. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js +70 -0
  68. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js.map +1 -0
  69. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts +109 -0
  70. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts.map +1 -0
  71. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js +209 -0
  72. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js.map +1 -0
  73. package/dist/mcp-server/tasks/core/taskManager.d.ts +103 -0
  74. package/dist/mcp-server/tasks/core/taskManager.d.ts.map +1 -0
  75. package/dist/mcp-server/tasks/core/taskManager.js +144 -0
  76. package/dist/mcp-server/tasks/core/taskManager.js.map +1 -0
  77. package/dist/mcp-server/tasks/core/taskTypes.d.ts +11 -0
  78. package/dist/mcp-server/tasks/core/taskTypes.d.ts.map +1 -0
  79. package/dist/mcp-server/tasks/core/taskTypes.js +13 -0
  80. package/dist/mcp-server/tasks/core/taskTypes.js.map +1 -0
  81. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts +108 -0
  82. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts.map +1 -0
  83. package/dist/mcp-server/tasks/utils/taskToolDefinition.js +14 -0
  84. package/dist/mcp-server/tasks/utils/taskToolDefinition.js.map +1 -0
  85. package/dist/mcp-server/tools/tool-registration.d.ts +49 -0
  86. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -0
  87. package/dist/mcp-server/tools/tool-registration.js +269 -0
  88. package/dist/mcp-server/tools/tool-registration.js.map +1 -0
  89. package/dist/mcp-server/tools/utils/newToolDefinition.d.ts +73 -0
  90. package/dist/mcp-server/tools/utils/newToolDefinition.d.ts.map +1 -0
  91. package/dist/mcp-server/tools/utils/newToolDefinition.js +45 -0
  92. package/dist/mcp-server/tools/utils/newToolDefinition.js.map +1 -0
  93. package/dist/mcp-server/tools/utils/newToolHandlerFactory.d.ts +33 -0
  94. package/dist/mcp-server/tools/utils/newToolHandlerFactory.d.ts.map +1 -0
  95. package/dist/mcp-server/tools/utils/newToolHandlerFactory.js +107 -0
  96. package/dist/mcp-server/tools/utils/newToolHandlerFactory.js.map +1 -0
  97. package/dist/mcp-server/tools/utils/toolDefinition.d.ts +118 -0
  98. package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -0
  99. package/dist/mcp-server/tools/utils/toolDefinition.js +2 -0
  100. package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -0
  101. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +34 -0
  102. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -0
  103. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +68 -0
  104. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -0
  105. package/dist/mcp-server/transports/ITransport.d.ts +15 -0
  106. package/dist/mcp-server/transports/ITransport.d.ts.map +1 -0
  107. package/dist/mcp-server/transports/ITransport.js +2 -0
  108. package/dist/mcp-server/transports/ITransport.js.map +1 -0
  109. package/dist/mcp-server/transports/auth/authFactory.d.ts +11 -0
  110. package/dist/mcp-server/transports/auth/authFactory.d.ts.map +1 -0
  111. package/dist/mcp-server/transports/auth/authFactory.js +43 -0
  112. package/dist/mcp-server/transports/auth/authFactory.js.map +1 -0
  113. package/dist/mcp-server/transports/auth/authMiddleware.d.ts +24 -0
  114. package/dist/mcp-server/transports/auth/authMiddleware.d.ts.map +1 -0
  115. package/dist/mcp-server/transports/auth/authMiddleware.js +69 -0
  116. package/dist/mcp-server/transports/auth/authMiddleware.js.map +1 -0
  117. package/dist/mcp-server/transports/auth/lib/authContext.d.ts +34 -0
  118. package/dist/mcp-server/transports/auth/lib/authContext.d.ts.map +1 -0
  119. package/dist/mcp-server/transports/auth/lib/authContext.js +25 -0
  120. package/dist/mcp-server/transports/auth/lib/authContext.js.map +1 -0
  121. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +19 -0
  122. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -0
  123. package/dist/mcp-server/transports/auth/lib/authTypes.js +2 -0
  124. package/dist/mcp-server/transports/auth/lib/authTypes.js.map +1 -0
  125. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts +18 -0
  126. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -0
  127. package/dist/mcp-server/transports/auth/lib/authUtils.js +64 -0
  128. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -0
  129. package/dist/mcp-server/transports/auth/lib/checkScopes.d.ts +25 -0
  130. package/dist/mcp-server/transports/auth/lib/checkScopes.d.ts.map +1 -0
  131. package/dist/mcp-server/transports/auth/lib/checkScopes.js +34 -0
  132. package/dist/mcp-server/transports/auth/lib/checkScopes.js.map +1 -0
  133. package/dist/mcp-server/transports/auth/lib/claimParser.d.ts +34 -0
  134. package/dist/mcp-server/transports/auth/lib/claimParser.d.ts.map +1 -0
  135. package/dist/mcp-server/transports/auth/lib/claimParser.js +58 -0
  136. package/dist/mcp-server/transports/auth/lib/claimParser.js.map +1 -0
  137. package/dist/mcp-server/transports/auth/lib/withAuth.d.ts +25 -0
  138. package/dist/mcp-server/transports/auth/lib/withAuth.d.ts.map +1 -0
  139. package/dist/mcp-server/transports/auth/lib/withAuth.js +30 -0
  140. package/dist/mcp-server/transports/auth/lib/withAuth.js.map +1 -0
  141. package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts +18 -0
  142. package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts.map +1 -0
  143. package/dist/mcp-server/transports/auth/strategies/authStrategy.js +2 -0
  144. package/dist/mcp-server/transports/auth/strategies/authStrategy.js.map +1 -0
  145. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts +14 -0
  146. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts.map +1 -0
  147. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +86 -0
  148. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -0
  149. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts +14 -0
  150. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -0
  151. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +113 -0
  152. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -0
  153. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts +25 -0
  154. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -0
  155. package/dist/mcp-server/transports/http/httpErrorHandler.js +112 -0
  156. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -0
  157. package/dist/mcp-server/transports/http/httpTransport.d.ts +47 -0
  158. package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -0
  159. package/dist/mcp-server/transports/http/httpTransport.js +396 -0
  160. package/dist/mcp-server/transports/http/httpTransport.js.map +1 -0
  161. package/dist/mcp-server/transports/http/httpTypes.d.ts +17 -0
  162. package/dist/mcp-server/transports/http/httpTypes.d.ts.map +1 -0
  163. package/dist/mcp-server/transports/http/httpTypes.js +2 -0
  164. package/dist/mcp-server/transports/http/httpTypes.js.map +1 -0
  165. package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts +21 -0
  166. package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts.map +1 -0
  167. package/dist/mcp-server/transports/http/protectedResourceMetadata.js +44 -0
  168. package/dist/mcp-server/transports/http/protectedResourceMetadata.js.map +1 -0
  169. package/dist/mcp-server/transports/http/sessionIdUtils.d.ts +33 -0
  170. package/dist/mcp-server/transports/http/sessionIdUtils.d.ts.map +1 -0
  171. package/dist/mcp-server/transports/http/sessionIdUtils.js +54 -0
  172. package/dist/mcp-server/transports/http/sessionIdUtils.js.map +1 -0
  173. package/dist/mcp-server/transports/http/sessionStore.d.ts +87 -0
  174. package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -0
  175. package/dist/mcp-server/transports/http/sessionStore.js +209 -0
  176. package/dist/mcp-server/transports/http/sessionStore.js.map +1 -0
  177. package/dist/mcp-server/transports/manager.d.ts +22 -0
  178. package/dist/mcp-server/transports/manager.d.ts.map +1 -0
  179. package/dist/mcp-server/transports/manager.js +62 -0
  180. package/dist/mcp-server/transports/manager.js.map +1 -0
  181. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +44 -0
  182. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -0
  183. package/dist/mcp-server/transports/stdio/stdioTransport.js +63 -0
  184. package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -0
  185. package/dist/services/graph/core/GraphService.d.ts +205 -0
  186. package/dist/services/graph/core/GraphService.d.ts.map +1 -0
  187. package/dist/services/graph/core/GraphService.js +231 -0
  188. package/dist/services/graph/core/GraphService.js.map +1 -0
  189. package/dist/services/graph/core/IGraphProvider.d.ts +295 -0
  190. package/dist/services/graph/core/IGraphProvider.d.ts.map +1 -0
  191. package/dist/services/graph/core/IGraphProvider.js +8 -0
  192. package/dist/services/graph/core/IGraphProvider.js.map +1 -0
  193. package/dist/services/graph/types.d.ts +107 -0
  194. package/dist/services/graph/types.d.ts.map +1 -0
  195. package/dist/services/graph/types.js +8 -0
  196. package/dist/services/graph/types.js.map +1 -0
  197. package/dist/services/llm/core/ILlmProvider.d.ts +86 -0
  198. package/dist/services/llm/core/ILlmProvider.d.ts.map +1 -0
  199. package/dist/services/llm/core/ILlmProvider.js +2 -0
  200. package/dist/services/llm/core/ILlmProvider.js.map +1 -0
  201. package/dist/services/llm/providers/openrouter.provider.d.ts +187 -0
  202. package/dist/services/llm/providers/openrouter.provider.d.ts.map +1 -0
  203. package/dist/services/llm/providers/openrouter.provider.js +302 -0
  204. package/dist/services/llm/providers/openrouter.provider.js.map +1 -0
  205. package/dist/services/llm/types.d.ts +16 -0
  206. package/dist/services/llm/types.d.ts.map +1 -0
  207. package/dist/services/llm/types.js +9 -0
  208. package/dist/services/llm/types.js.map +1 -0
  209. package/dist/services/speech/core/ISpeechProvider.d.ts +92 -0
  210. package/dist/services/speech/core/ISpeechProvider.d.ts.map +1 -0
  211. package/dist/services/speech/core/ISpeechProvider.js +34 -0
  212. package/dist/services/speech/core/ISpeechProvider.js.map +1 -0
  213. package/dist/services/speech/core/SpeechService.d.ts +87 -0
  214. package/dist/services/speech/core/SpeechService.d.ts.map +1 -0
  215. package/dist/services/speech/core/SpeechService.js +135 -0
  216. package/dist/services/speech/core/SpeechService.js.map +1 -0
  217. package/dist/services/speech/providers/elevenlabs.provider.d.ts +77 -0
  218. package/dist/services/speech/providers/elevenlabs.provider.d.ts.map +1 -0
  219. package/dist/services/speech/providers/elevenlabs.provider.js +199 -0
  220. package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -0
  221. package/dist/services/speech/providers/whisper.provider.d.ts +94 -0
  222. package/dist/services/speech/providers/whisper.provider.d.ts.map +1 -0
  223. package/dist/services/speech/providers/whisper.provider.js +240 -0
  224. package/dist/services/speech/providers/whisper.provider.js.map +1 -0
  225. package/dist/services/speech/types.d.ts +173 -0
  226. package/dist/services/speech/types.d.ts.map +1 -0
  227. package/dist/services/speech/types.js +8 -0
  228. package/dist/services/speech/types.js.map +1 -0
  229. package/dist/storage/core/IStorageProvider.d.ts +159 -0
  230. package/dist/storage/core/IStorageProvider.d.ts.map +1 -0
  231. package/dist/storage/core/IStorageProvider.js +2 -0
  232. package/dist/storage/core/IStorageProvider.js.map +1 -0
  233. package/dist/storage/core/StorageService.d.ts +22 -0
  234. package/dist/storage/core/StorageService.d.ts.map +1 -0
  235. package/dist/storage/core/StorageService.js +151 -0
  236. package/dist/storage/core/StorageService.js.map +1 -0
  237. package/dist/storage/core/storageFactory.d.ts +66 -0
  238. package/dist/storage/core/storageFactory.d.ts.map +1 -0
  239. package/dist/storage/core/storageFactory.js +122 -0
  240. package/dist/storage/core/storageFactory.js.map +1 -0
  241. package/dist/storage/core/storageValidation.d.ts +77 -0
  242. package/dist/storage/core/storageValidation.d.ts.map +1 -0
  243. package/dist/storage/core/storageValidation.js +303 -0
  244. package/dist/storage/core/storageValidation.js.map +1 -0
  245. package/dist/storage/providers/cloudflare/d1Provider.d.ts +94 -0
  246. package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -0
  247. package/dist/storage/providers/cloudflare/d1Provider.js +347 -0
  248. package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -0
  249. package/dist/storage/providers/cloudflare/kvProvider.d.ts +21 -0
  250. package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -0
  251. package/dist/storage/providers/cloudflare/kvProvider.js +183 -0
  252. package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -0
  253. package/dist/storage/providers/cloudflare/r2Provider.d.ts +28 -0
  254. package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -0
  255. package/dist/storage/providers/cloudflare/r2Provider.js +222 -0
  256. package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -0
  257. package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts +20 -0
  258. package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts.map +1 -0
  259. package/dist/storage/providers/fileSystem/fileSystemProvider.js +282 -0
  260. package/dist/storage/providers/fileSystem/fileSystemProvider.js.map +1 -0
  261. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +21 -0
  262. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -0
  263. package/dist/storage/providers/inMemory/inMemoryProvider.js +139 -0
  264. package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -0
  265. package/dist/storage/providers/supabase/supabase.types.d.ts +49 -0
  266. package/dist/storage/providers/supabase/supabase.types.d.ts.map +1 -0
  267. package/dist/storage/providers/supabase/supabase.types.js +8 -0
  268. package/dist/storage/providers/supabase/supabase.types.js.map +1 -0
  269. package/dist/storage/providers/supabase/supabaseProvider.d.ts +24 -0
  270. package/dist/storage/providers/supabase/supabaseProvider.d.ts.map +1 -0
  271. package/dist/storage/providers/supabase/supabaseProvider.js +209 -0
  272. package/dist/storage/providers/supabase/supabaseProvider.js.map +1 -0
  273. package/dist/testing/index.d.ts +53 -0
  274. package/dist/testing/index.d.ts.map +1 -0
  275. package/dist/testing/index.js +132 -0
  276. package/dist/testing/index.js.map +1 -0
  277. package/dist/types-global/errors.d.ts +83 -0
  278. package/dist/types-global/errors.d.ts.map +1 -0
  279. package/dist/types-global/errors.js +113 -0
  280. package/dist/types-global/errors.js.map +1 -0
  281. package/dist/utils/formatting/diffFormatter.d.ts +227 -0
  282. package/dist/utils/formatting/diffFormatter.d.ts.map +1 -0
  283. package/dist/utils/formatting/diffFormatter.js +369 -0
  284. package/dist/utils/formatting/diffFormatter.js.map +1 -0
  285. package/dist/utils/formatting/index.d.ts +9 -0
  286. package/dist/utils/formatting/index.d.ts.map +1 -0
  287. package/dist/utils/formatting/index.js +9 -0
  288. package/dist/utils/formatting/index.js.map +1 -0
  289. package/dist/utils/formatting/markdownBuilder.d.ts +543 -0
  290. package/dist/utils/formatting/markdownBuilder.d.ts.map +1 -0
  291. package/dist/utils/formatting/markdownBuilder.js +674 -0
  292. package/dist/utils/formatting/markdownBuilder.js.map +1 -0
  293. package/dist/utils/formatting/tableFormatter.d.ts +261 -0
  294. package/dist/utils/formatting/tableFormatter.d.ts.map +1 -0
  295. package/dist/utils/formatting/tableFormatter.js +456 -0
  296. package/dist/utils/formatting/tableFormatter.js.map +1 -0
  297. package/dist/utils/formatting/treeFormatter.d.ts +344 -0
  298. package/dist/utils/formatting/treeFormatter.d.ts.map +1 -0
  299. package/dist/utils/formatting/treeFormatter.js +400 -0
  300. package/dist/utils/formatting/treeFormatter.js.map +1 -0
  301. package/dist/utils/internal/encoding.d.ts +42 -0
  302. package/dist/utils/internal/encoding.d.ts.map +1 -0
  303. package/dist/utils/internal/encoding.js +87 -0
  304. package/dist/utils/internal/encoding.js.map +1 -0
  305. package/dist/utils/internal/error-handler/errorHandler.d.ts +140 -0
  306. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -0
  307. package/dist/utils/internal/error-handler/errorHandler.js +318 -0
  308. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -0
  309. package/dist/utils/internal/error-handler/helpers.d.ts +98 -0
  310. package/dist/utils/internal/error-handler/helpers.d.ts.map +1 -0
  311. package/dist/utils/internal/error-handler/helpers.js +214 -0
  312. package/dist/utils/internal/error-handler/helpers.js.map +1 -0
  313. package/dist/utils/internal/error-handler/mappings.d.ts +85 -0
  314. package/dist/utils/internal/error-handler/mappings.d.ts.map +1 -0
  315. package/dist/utils/internal/error-handler/mappings.js +234 -0
  316. package/dist/utils/internal/error-handler/mappings.js.map +1 -0
  317. package/dist/utils/internal/error-handler/types.d.ts +160 -0
  318. package/dist/utils/internal/error-handler/types.d.ts.map +1 -0
  319. package/dist/utils/internal/error-handler/types.js +6 -0
  320. package/dist/utils/internal/error-handler/types.js.map +1 -0
  321. package/dist/utils/internal/health.d.ts +60 -0
  322. package/dist/utils/internal/health.d.ts.map +1 -0
  323. package/dist/utils/internal/health.js +46 -0
  324. package/dist/utils/internal/health.js.map +1 -0
  325. package/dist/utils/internal/logger.d.ts +300 -0
  326. package/dist/utils/internal/logger.d.ts.map +1 -0
  327. package/dist/utils/internal/logger.js +573 -0
  328. package/dist/utils/internal/logger.js.map +1 -0
  329. package/dist/utils/internal/performance.d.ts +78 -0
  330. package/dist/utils/internal/performance.d.ts.map +1 -0
  331. package/dist/utils/internal/performance.js +227 -0
  332. package/dist/utils/internal/performance.js.map +1 -0
  333. package/dist/utils/internal/requestContext.d.ts +200 -0
  334. package/dist/utils/internal/requestContext.d.ts.map +1 -0
  335. package/dist/utils/internal/requestContext.js +163 -0
  336. package/dist/utils/internal/requestContext.js.map +1 -0
  337. package/dist/utils/internal/runtime.d.ts +49 -0
  338. package/dist/utils/internal/runtime.d.ts.map +1 -0
  339. package/dist/utils/internal/runtime.js +90 -0
  340. package/dist/utils/internal/runtime.js.map +1 -0
  341. package/dist/utils/internal/startupBanner.d.ts +23 -0
  342. package/dist/utils/internal/startupBanner.d.ts.map +1 -0
  343. package/dist/utils/internal/startupBanner.js +34 -0
  344. package/dist/utils/internal/startupBanner.js.map +1 -0
  345. package/dist/utils/metrics/tokenCounter.d.ts +97 -0
  346. package/dist/utils/metrics/tokenCounter.d.ts.map +1 -0
  347. package/dist/utils/metrics/tokenCounter.js +162 -0
  348. package/dist/utils/metrics/tokenCounter.js.map +1 -0
  349. package/dist/utils/network/fetchWithTimeout.d.ts +91 -0
  350. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -0
  351. package/dist/utils/network/fetchWithTimeout.js +305 -0
  352. package/dist/utils/network/fetchWithTimeout.js.map +1 -0
  353. package/dist/utils/pagination/pagination.d.ts +157 -0
  354. package/dist/utils/pagination/pagination.d.ts.map +1 -0
  355. package/dist/utils/pagination/pagination.js +191 -0
  356. package/dist/utils/pagination/pagination.js.map +1 -0
  357. package/dist/utils/parsing/csvParser.d.ts +84 -0
  358. package/dist/utils/parsing/csvParser.d.ts.map +1 -0
  359. package/dist/utils/parsing/csvParser.js +132 -0
  360. package/dist/utils/parsing/csvParser.js.map +1 -0
  361. package/dist/utils/parsing/dateParser.d.ts +103 -0
  362. package/dist/utils/parsing/dateParser.d.ts.map +1 -0
  363. package/dist/utils/parsing/dateParser.js +142 -0
  364. package/dist/utils/parsing/dateParser.js.map +1 -0
  365. package/dist/utils/parsing/frontmatterParser.d.ts +91 -0
  366. package/dist/utils/parsing/frontmatterParser.d.ts.map +1 -0
  367. package/dist/utils/parsing/frontmatterParser.js +163 -0
  368. package/dist/utils/parsing/frontmatterParser.js.map +1 -0
  369. package/dist/utils/parsing/index.d.ts +15 -0
  370. package/dist/utils/parsing/index.d.ts.map +1 -0
  371. package/dist/utils/parsing/index.js +15 -0
  372. package/dist/utils/parsing/index.js.map +1 -0
  373. package/dist/utils/parsing/jsonParser.d.ts +115 -0
  374. package/dist/utils/parsing/jsonParser.d.ts.map +1 -0
  375. package/dist/utils/parsing/jsonParser.js +177 -0
  376. package/dist/utils/parsing/jsonParser.js.map +1 -0
  377. package/dist/utils/parsing/pdfParser.d.ts +563 -0
  378. package/dist/utils/parsing/pdfParser.d.ts.map +1 -0
  379. package/dist/utils/parsing/pdfParser.js +775 -0
  380. package/dist/utils/parsing/pdfParser.js.map +1 -0
  381. package/dist/utils/parsing/thinkBlock.d.ts +31 -0
  382. package/dist/utils/parsing/thinkBlock.d.ts.map +1 -0
  383. package/dist/utils/parsing/thinkBlock.js +31 -0
  384. package/dist/utils/parsing/thinkBlock.js.map +1 -0
  385. package/dist/utils/parsing/xmlParser.d.ts +69 -0
  386. package/dist/utils/parsing/xmlParser.d.ts.map +1 -0
  387. package/dist/utils/parsing/xmlParser.js +140 -0
  388. package/dist/utils/parsing/xmlParser.js.map +1 -0
  389. package/dist/utils/parsing/yamlParser.d.ts +64 -0
  390. package/dist/utils/parsing/yamlParser.d.ts.map +1 -0
  391. package/dist/utils/parsing/yamlParser.js +129 -0
  392. package/dist/utils/parsing/yamlParser.js.map +1 -0
  393. package/dist/utils/scheduling/scheduler.d.ts +174 -0
  394. package/dist/utils/scheduling/scheduler.d.ts.map +1 -0
  395. package/dist/utils/scheduling/scheduler.js +248 -0
  396. package/dist/utils/scheduling/scheduler.js.map +1 -0
  397. package/dist/utils/security/idGenerator.d.ts +189 -0
  398. package/dist/utils/security/idGenerator.d.ts.map +1 -0
  399. package/dist/utils/security/idGenerator.js +301 -0
  400. package/dist/utils/security/idGenerator.js.map +1 -0
  401. package/dist/utils/security/index.d.ts +8 -0
  402. package/dist/utils/security/index.d.ts.map +1 -0
  403. package/dist/utils/security/index.js +8 -0
  404. package/dist/utils/security/index.js.map +1 -0
  405. package/dist/utils/security/rateLimiter.d.ts +171 -0
  406. package/dist/utils/security/rateLimiter.d.ts.map +1 -0
  407. package/dist/utils/security/rateLimiter.js +294 -0
  408. package/dist/utils/security/rateLimiter.js.map +1 -0
  409. package/dist/utils/security/sanitization.d.ts +430 -0
  410. package/dist/utils/security/sanitization.d.ts.map +1 -0
  411. package/dist/utils/security/sanitization.js +759 -0
  412. package/dist/utils/security/sanitization.js.map +1 -0
  413. package/dist/utils/telemetry/index.d.ts +12 -0
  414. package/dist/utils/telemetry/index.d.ts.map +1 -0
  415. package/dist/utils/telemetry/index.js +12 -0
  416. package/dist/utils/telemetry/index.js.map +1 -0
  417. package/dist/utils/telemetry/instrumentation.d.ts +62 -0
  418. package/dist/utils/telemetry/instrumentation.d.ts.map +1 -0
  419. package/dist/utils/telemetry/instrumentation.js +223 -0
  420. package/dist/utils/telemetry/instrumentation.js.map +1 -0
  421. package/dist/utils/telemetry/metrics.d.ts +170 -0
  422. package/dist/utils/telemetry/metrics.d.ts.map +1 -0
  423. package/dist/utils/telemetry/metrics.js +205 -0
  424. package/dist/utils/telemetry/metrics.js.map +1 -0
  425. package/dist/utils/telemetry/semconv.d.ts +147 -0
  426. package/dist/utils/telemetry/semconv.d.ts.map +1 -0
  427. package/dist/utils/telemetry/semconv.js +159 -0
  428. package/dist/utils/telemetry/semconv.js.map +1 -0
  429. package/dist/utils/telemetry/trace.d.ts +141 -0
  430. package/dist/utils/telemetry/trace.d.ts.map +1 -0
  431. package/dist/utils/telemetry/trace.js +193 -0
  432. package/dist/utils/telemetry/trace.js.map +1 -0
  433. package/dist/utils/types/guards.d.ts +209 -0
  434. package/dist/utils/types/guards.d.ts.map +1 -0
  435. package/dist/utils/types/guards.js +229 -0
  436. package/dist/utils/types/guards.js.map +1 -0
  437. package/dist/utils/types/index.d.ts +6 -0
  438. package/dist/utils/types/index.d.ts.map +1 -0
  439. package/dist/utils/types/index.js +6 -0
  440. package/dist/utils/types/index.js.map +1 -0
  441. package/dist/worker.d.ts +59 -0
  442. package/dist/worker.d.ts.map +1 -0
  443. package/dist/worker.js +216 -0
  444. package/dist/worker.js.map +1 -0
  445. package/package.json +377 -0
  446. package/skills/README.md +38 -0
  447. package/skills/add-export/SKILL.md +49 -0
  448. package/skills/add-prompt/SKILL.md +97 -0
  449. package/skills/add-provider/SKILL.md +53 -0
  450. package/skills/add-resource/SKILL.md +107 -0
  451. package/skills/add-service/SKILL.md +113 -0
  452. package/skills/add-tool/SKILL.md +110 -0
  453. package/skills/api-auth/SKILL.md +173 -0
  454. package/skills/api-config/SKILL.md +68 -0
  455. package/skills/api-context/SKILL.md +321 -0
  456. package/skills/api-errors/SKILL.md +146 -0
  457. package/skills/api-services/SKILL.md +24 -0
  458. package/skills/api-services/references/graph.md +124 -0
  459. package/skills/api-services/references/llm.md +46 -0
  460. package/skills/api-services/references/speech.md +72 -0
  461. package/skills/api-testing/SKILL.md +263 -0
  462. package/skills/api-utils/SKILL.md +106 -0
  463. package/skills/api-utils/references/formatting.md +237 -0
  464. package/skills/api-utils/references/parsing.md +263 -0
  465. package/skills/api-utils/references/security.md +226 -0
  466. package/skills/api-workers/SKILL.md +165 -0
  467. package/skills/devcheck/SKILL.md +31 -0
  468. package/skills/maintenance/SKILL.md +52 -0
  469. package/skills/migrate-mcp-ts-template/SKILL.md +131 -0
  470. package/skills/release/SKILL.md +67 -0
  471. package/skills/setup/SKILL.md +89 -0
  472. package/skills/walkthrough-init/SKILL.md +50 -0
  473. package/templates/.env.example +17 -0
  474. package/templates/AGENTS.md +113 -0
  475. package/templates/CLAUDE.md +113 -0
  476. package/templates/_tsconfig.json +33 -0
  477. package/templates/biome.template.json +43 -0
  478. package/templates/package.json +26 -0
  479. package/templates/src/index.ts +16 -0
  480. package/templates/src/mcp-server/prompts/definitions/echo.prompt.ts +19 -0
  481. package/templates/src/mcp-server/resources/definitions/echo.resource.ts +30 -0
  482. package/templates/src/mcp-server/tools/definitions/echo.tool.ts +24 -0
  483. package/templates/vitest.config.ts +12 -0
  484. package/tsconfig.base.json +44 -0
  485. package/vitest.config.base.ts +38 -0
@@ -0,0 +1,144 @@
1
+ import { logger } from '../../../utils/internal/logger.js';
2
+ import { idGenerator } from '../../../utils/security/idGenerator.js';
3
+ import { SessionAwareTaskStore } from './sessionAwareTaskStore.js';
4
+ import { StorageBackedTaskStore } from './storageBackedTaskStore.js';
5
+ import { InMemoryTaskMessageQueue, InMemoryTaskStore, } from './taskTypes.js';
6
+ /**
7
+ * Singleton service that manages task state and message queues for the MCP server.
8
+ *
9
+ * The TaskManager provides:
10
+ * - A shared TaskStore for creating, tracking, and completing tasks
11
+ * - A shared TaskMessageQueue for side-channel message delivery
12
+ * - Cleanup methods for graceful shutdown
13
+ *
14
+ * The store type is determined by configuration:
15
+ * - `in-memory`: Fast, suitable for development (data lost on restart)
16
+ * - `storage`: Persistent, uses configured StorageService backend
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * // Inject via DI
21
+ * constructor(@inject(TaskManagerToken) private taskManager: TaskManager) {}
22
+ *
23
+ * // Access stores
24
+ * const taskStore = this.taskManager.getTaskStore();
25
+ * const messageQueue = this.taskManager.getMessageQueue();
26
+ * ```
27
+ *
28
+ * @experimental
29
+ */
30
+ export class TaskManager {
31
+ taskStore;
32
+ inMemoryTaskStore = null;
33
+ messageQueue;
34
+ storeType;
35
+ isShuttingDown = false;
36
+ constructor(config, storageService) {
37
+ this.storeType = config.tasks.storeType;
38
+ this.messageQueue = new InMemoryTaskMessageQueue();
39
+ if (this.storeType === 'storage') {
40
+ this.taskStore = new StorageBackedTaskStore(storageService, {
41
+ tenantId: config.tasks.tenantId,
42
+ defaultTtl: config.tasks.defaultTtlMs ?? null,
43
+ });
44
+ }
45
+ else {
46
+ this.inMemoryTaskStore = new InMemoryTaskStore();
47
+ // Wrap with session ownership enforcement — the SDK's InMemoryTaskStore
48
+ // ignores sessionId parameters, so SessionAwareTaskStore adds that layer.
49
+ this.taskStore = new SessionAwareTaskStore(this.inMemoryTaskStore);
50
+ }
51
+ logger.info(`TaskManager initialized with ${this.storeType} task store`, {
52
+ operation: 'TaskManager.constructor',
53
+ requestId: idGenerator.generate('req'),
54
+ timestamp: new Date().toISOString(),
55
+ storeType: this.storeType,
56
+ ...(this.storeType === 'storage' && { tenantId: config.tasks.tenantId }),
57
+ });
58
+ }
59
+ /**
60
+ * Returns the TaskStore instance for managing task lifecycle.
61
+ *
62
+ * The TaskStore handles:
63
+ * - Task creation with TTL and poll intervals
64
+ * - Status updates (working, input_required, completed, failed, cancelled)
65
+ * - Result storage and retrieval
66
+ * - Task listing with pagination
67
+ *
68
+ * @returns The singleton TaskStore instance
69
+ */
70
+ getTaskStore() {
71
+ return this.taskStore;
72
+ }
73
+ /**
74
+ * Returns the TaskMessageQueue instance for side-channel messaging.
75
+ *
76
+ * The message queue enables:
77
+ * - Queuing requests/notifications for delivery via tasks/result
78
+ * - FIFO ordering per task
79
+ * - Atomic enqueue with size limits
80
+ *
81
+ * @returns The singleton TaskMessageQueue instance
82
+ */
83
+ getMessageQueue() {
84
+ return this.messageQueue;
85
+ }
86
+ /**
87
+ * Returns the store type currently in use.
88
+ *
89
+ * @returns 'in-memory' or 'storage'
90
+ */
91
+ getStoreType() {
92
+ return this.storeType;
93
+ }
94
+ /**
95
+ * Performs cleanup of task resources.
96
+ *
97
+ * Should be called during graceful server shutdown to:
98
+ * - Cancel cleanup timers in the in-memory task store
99
+ * - Clear any pending message queues
100
+ *
101
+ * Note: Storage-backed task stores don't require cleanup as data persists.
102
+ *
103
+ * @param context - Request context for logging
104
+ */
105
+ cleanup(context) {
106
+ if (this.isShuttingDown) {
107
+ return;
108
+ }
109
+ this.isShuttingDown = true;
110
+ const logContext = context ?? {
111
+ operation: 'TaskManager.cleanup',
112
+ requestId: idGenerator.generate('req'),
113
+ timestamp: new Date().toISOString(),
114
+ };
115
+ logger.info('Cleaning up TaskManager resources...', logContext);
116
+ // Only InMemoryTaskStore has cleanup timers
117
+ if (this.inMemoryTaskStore) {
118
+ this.inMemoryTaskStore.cleanup();
119
+ }
120
+ logger.info('TaskManager cleanup complete', logContext);
121
+ }
122
+ /**
123
+ * Returns the current task count (for debugging/monitoring).
124
+ * Only available for in-memory store; returns `null` for storage-backed store.
125
+ *
126
+ * @returns The number of tasks currently tracked, or `null` if unavailable
127
+ */
128
+ getTaskCount() {
129
+ if (this.inMemoryTaskStore) {
130
+ return this.inMemoryTaskStore.getAllTasks().length;
131
+ }
132
+ // Storage-backed store doesn't have getAllTasks - would require listing
133
+ return null;
134
+ }
135
+ /**
136
+ * Checks if the TaskManager is shutting down.
137
+ *
138
+ * @returns True if cleanup has been initiated
139
+ */
140
+ isCleaningUp() {
141
+ return this.isShuttingDown;
142
+ }
143
+ }
144
+ //# sourceMappingURL=taskManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskManager.js","sourceRoot":"","sources":["../../../../src/mcp-server/tasks/core/taskManager.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,WAAW;IACL,SAAS,CAAY;IACrB,iBAAiB,GAA6B,IAAI,CAAC;IACnD,YAAY,CAA2B;IACvC,SAAS,CAA0B;IAC5C,cAAc,GAAG,KAAK,CAAC;IAE/B,YAAY,MAAyB,EAAE,cAA8B;QACnE,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAEnD,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,SAAS,GAAG,IAAI,sBAAsB,CAAC,cAAc,EAAE;gBAC1D,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;gBAC/B,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,IAAI;a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AAC,CAAC;QAEhE,4CAA4C;QAC5C,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,8BAA8B,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;OAKG;IACI,YAAY;QACjB,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC;QACrD,CAAC;QACD,wEAAwE;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,YAAY;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @fileoverview Re-exports task-related types from the MCP SDK experimental module.
3
+ * These types are used for implementing task-based tools that support long-running
4
+ * async operations with the "call-now, fetch-later" pattern.
5
+ *
6
+ * @experimental These APIs are experimental and may change without notice.
7
+ * @module src/mcp-server/tasks/core/taskTypes
8
+ */
9
+ export type { CancelTaskRequest, CancelTaskResult, CreateTaskOptions, CreateTaskRequestHandlerExtra, CreateTaskResult, ErrorMessage, GetTaskPayloadRequest, GetTaskRequest, GetTaskResult, ListTasksRequest, ListTasksResult, QueuedMessage, RelatedTaskMetadata, ResponseMessage, ResultMessage, Task, TaskCreatedMessage, TaskCreationParams, TaskMessageQueue, TaskRequestHandlerExtra, TaskStatusMessage, TaskStatusNotification, TaskStatusNotificationParams, TaskStore, TaskToolExecution, ToolTaskHandler, } from '@modelcontextprotocol/sdk/experimental/tasks';
10
+ export { InMemoryTaskMessageQueue, InMemoryTaskStore, isTerminal, takeResult, toArrayAsync, } from '@modelcontextprotocol/sdk/experimental/tasks';
11
+ //# sourceMappingURL=taskTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskTypes.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tasks/core/taskTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,6BAA6B,EAC7B,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,SAAS,EACT,iBAAiB,EACjB,eAAe,GAChB,MAAM,8CAA8C,CAAC;AAItD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,8CAA8C,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @fileoverview Re-exports task-related types from the MCP SDK experimental module.
3
+ * These types are used for implementing task-based tools that support long-running
4
+ * async operations with the "call-now, fetch-later" pattern.
5
+ *
6
+ * @experimental These APIs are experimental and may change without notice.
7
+ * @module src/mcp-server/tasks/core/taskTypes
8
+ */
9
+ // In-memory implementations (reference implementations)
10
+ // Utility functions
11
+ // Helper functions for processing task responses
12
+ export { InMemoryTaskMessageQueue, InMemoryTaskStore, isTerminal, takeResult, toArrayAsync, } from '@modelcontextprotocol/sdk/experimental/tasks';
13
+ //# sourceMappingURL=taskTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskTypes.js","sourceRoot":"","sources":["../../../../src/mcp-server/tasks/core/taskTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkCH,wDAAwD;AACxD,oBAAoB;AACpB,iDAAiD;AACjD,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,YAAY,GACb,MAAM,8CAA8C,CAAC"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @fileoverview Defines the structure for task-based tool definitions.
3
+ * Task tools support long-running async operations with the MCP Tasks API,
4
+ * enabling "call-now, fetch-later" execution patterns.
5
+ *
6
+ * @experimental These APIs are experimental and may change without notice.
7
+ * @module src/mcp-server/tasks/utils/taskToolDefinition
8
+ */
9
+ import type { ZodObject, ZodRawShape } from 'zod';
10
+ import type { TaskToolExecution, ToolTaskHandler } from '../../../mcp-server/tasks/core/taskTypes.js';
11
+ import type { ToolAnnotations } from '../../../mcp-server/tools/utils/toolDefinition.js';
12
+ /**
13
+ * Represents a task-based tool definition for long-running async operations.
14
+ *
15
+ * Unlike regular tools that execute synchronously and return immediately,
16
+ * task tools create durable task handles that clients can poll for status
17
+ * and retrieve results after completion.
18
+ *
19
+ * Task tools are registered via `server.experimental.tasks.registerToolTask()`
20
+ * and must implement three handlers:
21
+ * - `createTask`: Called when the tool is invoked, creates the task and starts work
22
+ * - `getTask`: Called to poll task status (tasks/get)
23
+ * - `getTaskResult`: Called to retrieve results (tasks/result)
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * const myTaskTool: TaskToolDefinition<typeof InputSchema, typeof OutputSchema> = {
28
+ * name: 'long_running_analysis',
29
+ * description: 'Performs a long-running analysis operation',
30
+ * inputSchema: z.object({ data: z.string() }),
31
+ * outputSchema: z.object({ result: z.string() }),
32
+ * execution: { taskSupport: 'required' },
33
+ * taskHandlers: {
34
+ * createTask: async (args, extra) => {
35
+ * const task = await extra.taskStore.createTask({ ttl: 300000 }, ...);
36
+ * startBackgroundWork(task.taskId, args);
37
+ * return { task };
38
+ * },
39
+ * getTask: async (_args, extra) => {
40
+ * return await extra.taskStore.getTask(extra.taskId);
41
+ * },
42
+ * getTaskResult: async (_args, extra) => {
43
+ * return await extra.taskStore.getTaskResult(extra.taskId);
44
+ * }
45
+ * }
46
+ * };
47
+ * ```
48
+ *
49
+ * @experimental
50
+ */
51
+ export interface TaskToolDefinition<TInputSchema extends ZodObject<ZodRawShape>, TOutputSchema extends ZodObject<ZodRawShape>> {
52
+ /**
53
+ * Optional metadata providing hints about the tool's behavior.
54
+ */
55
+ annotations?: ToolAnnotations;
56
+ /**
57
+ * A clear, concise description of what the tool does.
58
+ * This is sent to the LLM to help it decide when to use the tool.
59
+ */
60
+ description: string;
61
+ /**
62
+ * Task execution configuration.
63
+ *
64
+ * - `taskSupport: 'required'` - Tool MUST be invoked as a task
65
+ * - `taskSupport: 'optional'` - Tool can be invoked normally or as a task
66
+ *
67
+ * Note: `taskSupport: 'forbidden'` is not valid for task tools;
68
+ * use a regular ToolDefinition instead.
69
+ */
70
+ execution: TaskToolExecution;
71
+ /**
72
+ * The Zod schema for validating the tool's input parameters.
73
+ * All fields should have `.describe()` for LLM context.
74
+ */
75
+ inputSchema: TInputSchema;
76
+ /**
77
+ * The programmatic, unique name for the tool (e.g., 'async_analysis').
78
+ * Must follow MCP tool naming conventions: alphanumeric, underscores, hyphens.
79
+ */
80
+ name: string;
81
+ /**
82
+ * The Zod schema for validating the tool's successful output structure.
83
+ * Used for documentation and client-side type inference.
84
+ */
85
+ outputSchema?: TOutputSchema;
86
+ /**
87
+ * The task handlers implementing the task lifecycle.
88
+ *
89
+ * These handlers are called by the SDK at different points:
90
+ * - `createTask`: When the tool is first invoked (tools/call with task param)
91
+ * - `getTask`: When polling for status (tasks/get)
92
+ * - `getTaskResult`: When retrieving results (tasks/result)
93
+ */
94
+ taskHandlers: ToolTaskHandler<TInputSchema>;
95
+ /**
96
+ * An optional, human-readable title for the tool.
97
+ * If not provided, derived from `name` or `annotations.title`.
98
+ */
99
+ title?: string;
100
+ }
101
+ /**
102
+ * Type guard to check if a tool definition is a task tool.
103
+ *
104
+ * @param def - The tool definition to check
105
+ * @returns True if the definition has taskHandlers (is a TaskToolDefinition)
106
+ */
107
+ export declare function isTaskToolDefinition(def: unknown): def is TaskToolDefinition<ZodObject<ZodRawShape>, ZodObject<ZodRawShape>>;
108
+ //# sourceMappingURL=taskToolDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskToolDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tasks/utils/taskToolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,kBAAkB,CACjC,YAAY,SAAS,SAAS,CAAC,WAAW,CAAC,EAC3C,aAAa,SAAS,SAAS,CAAC,WAAW,CAAC;IAE5C;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;;OAQG;IACH,SAAS,EAAE,iBAAiB,CAAC;IAE7B;;;OAGG;IACH,WAAW,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAE7B;;;;;;;OAOG;IACH,YAAY,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAE5C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,OAAO,GACX,GAAG,IAAI,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,CAQ3E"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Type guard to check if a tool definition is a task tool.
3
+ *
4
+ * @param def - The tool definition to check
5
+ * @returns True if the definition has taskHandlers (is a TaskToolDefinition)
6
+ */
7
+ export function isTaskToolDefinition(def) {
8
+ return (def !== null &&
9
+ typeof def === 'object' &&
10
+ 'taskHandlers' in def &&
11
+ def.taskHandlers !== null &&
12
+ typeof def.taskHandlers === 'object');
13
+ }
14
+ //# sourceMappingURL=taskToolDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskToolDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/tasks/utils/taskToolDefinition.ts"],"names":[],"mappings":"AA+GA;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAY;IAEZ,OAAO,CACL,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,QAAQ;QACvB,cAAc,IAAI,GAAG;QACrB,GAAG,CAAC,YAAY,KAAK,IAAI;QACzB,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,CACrC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @fileoverview Encapsulates the registration of all tool definitions with an McpServer.
3
+ * Supports legacy ToolDefinition, TaskToolDefinition, and new-style NewToolDefinition.
4
+ * @module src/mcp-server/tools/tool-registration
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import type { ZodObject, ZodRawShape } from 'zod';
8
+ import { type TaskToolDefinition } from '../../mcp-server/tasks/utils/taskToolDefinition.js';
9
+ import { type AnyNewToolDefinition } from '../../mcp-server/tools/utils/newToolDefinition.js';
10
+ import { type HandlerFactoryServices } from '../../mcp-server/tools/utils/newToolHandlerFactory.js';
11
+ import type { ToolDefinition } from '../../mcp-server/tools/utils/toolDefinition.js';
12
+ /** Union of all accepted tool definition shapes. */
13
+ export type AnyToolDef = ToolDefinition<ZodObject<ZodRawShape>, ZodObject<ZodRawShape>> | TaskToolDefinition<ZodObject<ZodRawShape>, ZodObject<ZodRawShape>> | AnyNewToolDefinition;
14
+ export declare class ToolRegistry {
15
+ private toolDefs;
16
+ private services?;
17
+ constructor(toolDefs: AnyToolDef[], services?: HandlerFactoryServices | undefined);
18
+ /**
19
+ * Registers all tool definitions with the provided McpServer instance.
20
+ * Automatically detects new-style, legacy, and task-based tools.
21
+ */
22
+ registerAll(server: McpServer): Promise<void>;
23
+ private deriveTitleFromName;
24
+ /**
25
+ * Registers a new-style tool definition (with `handler`, `input`, `auth`, etc.).
26
+ * Requires `services` to have been passed to the constructor for Context creation.
27
+ */
28
+ private registerNewTool;
29
+ /**
30
+ * Registers a new-style tool with `task: true` via the experimental Tasks API.
31
+ * Auto-generates task handlers from the definition's `handler` function.
32
+ * The framework manages the full task lifecycle: create, background run, store result.
33
+ */
34
+ private registerAutoTaskTool;
35
+ /**
36
+ * Runs a new-style tool handler as a background task.
37
+ * Creates Context with `progress` and `signal`, stores result/error on completion.
38
+ */
39
+ private runAutoTaskHandler;
40
+ private registerTool;
41
+ /**
42
+ * Registers a task-based tool with the MCP server via the experimental Tasks API.
43
+ * Task tools support long-running async operations with polling for status and results.
44
+ *
45
+ * @experimental
46
+ */
47
+ private registerTaskTool;
48
+ }
49
+ //# sourceMappingURL=tool-registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,yCAAyC,CAAC;AAGvF,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAGlD,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAQjF,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAClB,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,GAC9D,kBAAkB,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC,GAClE,oBAAoB,CAAC;AAEzB,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,QAAQ,CAAC;gBADT,QAAQ,EAAE,UAAU,EAAE,EACtB,QAAQ,CAAC,EAAE,sBAAsB,YAAA;IAG3C;;;OAGG;IACU,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA4C1D,OAAO,CAAC,mBAAmB;IAI3B;;;OAGG;YACW,eAAe;IA4C7B;;;;OAIG;YACW,oBAAoB;IA6ElC;;;OAGG;YACW,kBAAkB;YAqElB,YAAY;IAiD1B;;;;;OAKG;YACW,gBAAgB;CA0C/B"}
@@ -0,0 +1,269 @@
1
+ import { createContext } from '../../context.js';
2
+ import { isTaskToolDefinition, } from '../../mcp-server/tasks/utils/taskToolDefinition.js';
3
+ import { isNewToolDefinition, } from '../../mcp-server/tools/utils/newToolDefinition.js';
4
+ import { createNewToolHandler, } from '../../mcp-server/tools/utils/newToolHandlerFactory.js';
5
+ import { createMcpToolHandler } from '../../mcp-server/tools/utils/toolHandlerFactory.js';
6
+ import { withRequiredScopes } from '../../mcp-server/transports/auth/lib/authUtils.js';
7
+ import { JsonRpcErrorCode } from '../../types-global/errors.js';
8
+ import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
9
+ import { logger } from '../../utils/internal/logger.js';
10
+ import { requestContextService } from '../../utils/internal/requestContext.js';
11
+ export class ToolRegistry {
12
+ toolDefs;
13
+ services;
14
+ constructor(toolDefs, services) {
15
+ this.toolDefs = toolDefs;
16
+ this.services = services;
17
+ }
18
+ /**
19
+ * Registers all tool definitions with the provided McpServer instance.
20
+ * Automatically detects new-style, legacy, and task-based tools.
21
+ */
22
+ async registerAll(server) {
23
+ const context = requestContextService.createRequestContext({
24
+ operation: 'ToolRegistry.registerAll',
25
+ });
26
+ const newTools = [];
27
+ const legacyTools = [];
28
+ const taskTools = [];
29
+ for (const def of this.toolDefs) {
30
+ if (isNewToolDefinition(def)) {
31
+ newTools.push(def);
32
+ }
33
+ else if (isTaskToolDefinition(def)) {
34
+ taskTools.push(def);
35
+ }
36
+ else {
37
+ legacyTools.push(def);
38
+ }
39
+ }
40
+ logger.info(`Registering ${newTools.length + legacyTools.length} regular tool(s) and ${taskTools.length} task tool(s)...`, context);
41
+ // Register new-style tools (regular and auto-task)
42
+ for (const toolDef of newTools) {
43
+ if (toolDef.task) {
44
+ await this.registerAutoTaskTool(server, toolDef);
45
+ }
46
+ else {
47
+ await this.registerNewTool(server, toolDef);
48
+ }
49
+ }
50
+ // Register legacy tools
51
+ for (const toolDef of legacyTools) {
52
+ await this.registerTool(server, toolDef);
53
+ }
54
+ // Register task tools via experimental API
55
+ for (const toolDef of taskTools) {
56
+ await this.registerTaskTool(server, toolDef);
57
+ }
58
+ }
59
+ deriveTitleFromName(name) {
60
+ return name.replace(/_/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase());
61
+ }
62
+ /**
63
+ * Registers a new-style tool definition (with `handler`, `input`, `auth`, etc.).
64
+ * Requires `services` to have been passed to the constructor for Context creation.
65
+ */
66
+ async registerNewTool(server, tool) {
67
+ const registrationContext = requestContextService.createRequestContext({
68
+ operation: 'ToolRegistry.registerNewTool',
69
+ toolName: tool.name,
70
+ });
71
+ logger.debug(`Registering tool (new-style): '${tool.name}'`, registrationContext);
72
+ await ErrorHandler.tryCatch(() => {
73
+ if (!this.services) {
74
+ throw new Error(`Cannot register new-style tool '${tool.name}': HandlerFactoryServices not provided to ToolRegistry`);
75
+ }
76
+ const handler = createNewToolHandler(tool, this.services);
77
+ const title = tool.title ?? tool.annotations?.title ?? this.deriveTitleFromName(tool.name);
78
+ // Type assertion required: SDK's conditional types don't resolve with erased generics
79
+ server.registerTool(tool.name, {
80
+ title,
81
+ description: tool.description,
82
+ inputSchema: tool.input,
83
+ ...(tool.output && { outputSchema: tool.output }),
84
+ ...(tool.annotations && { annotations: tool.annotations }),
85
+ ...(tool._meta && { _meta: tool._meta }),
86
+ }, handler);
87
+ logger.notice(`Tool '${tool.name}' registered successfully.`, registrationContext);
88
+ }, {
89
+ operation: `RegisteringTool_${tool.name}`,
90
+ context: registrationContext,
91
+ errorCode: JsonRpcErrorCode.InitializationFailed,
92
+ critical: true,
93
+ });
94
+ }
95
+ /**
96
+ * Registers a new-style tool with `task: true` via the experimental Tasks API.
97
+ * Auto-generates task handlers from the definition's `handler` function.
98
+ * The framework manages the full task lifecycle: create, background run, store result.
99
+ */
100
+ async registerAutoTaskTool(server, tool) {
101
+ const registrationContext = requestContextService.createRequestContext({
102
+ operation: 'ToolRegistry.registerAutoTaskTool',
103
+ toolName: tool.name,
104
+ });
105
+ logger.debug(`Registering auto-task tool (new-style, task: true): '${tool.name}'`, registrationContext);
106
+ await ErrorHandler.tryCatch(() => {
107
+ if (!this.services) {
108
+ throw new Error(`Cannot register auto-task tool '${tool.name}': HandlerFactoryServices not provided to ToolRegistry`);
109
+ }
110
+ const services = this.services;
111
+ const title = tool.title ?? tool.annotations?.title ?? this.deriveTitleFromName(tool.name);
112
+ const formatter = (result) => tool.format
113
+ ? tool.format(result)
114
+ : [{ type: 'text', text: JSON.stringify(result, null, 2) }];
115
+ server.experimental.tasks.registerToolTask(tool.name, {
116
+ title,
117
+ description: tool.description,
118
+ inputSchema: tool.input,
119
+ ...(tool.output && { outputSchema: tool.output }),
120
+ ...(tool.annotations && { annotations: tool.annotations }),
121
+ execution: { taskSupport: 'optional' },
122
+ }, {
123
+ createTask: async (args, extra) => {
124
+ const validatedInput = tool.input.parse(args);
125
+ const task = await extra.taskStore.createTask({
126
+ ttl: 120_000,
127
+ pollInterval: 1000,
128
+ });
129
+ // Fire-and-forget: run handler in background
130
+ void this.runAutoTaskHandler(tool, validatedInput, task.taskId, extra.taskStore, services, formatter);
131
+ return { task };
132
+ },
133
+ getTask: async (_args, extra) => extra.taskStore.getTask(extra.taskId),
134
+ getTaskResult: async (_args, extra) => (await extra.taskStore.getTaskResult(extra.taskId)),
135
+ });
136
+ logger.notice(`Auto-task tool '${tool.name}' registered successfully (experimental).`, registrationContext);
137
+ }, {
138
+ operation: `RegisteringAutoTaskTool_${tool.name}`,
139
+ context: registrationContext,
140
+ errorCode: JsonRpcErrorCode.InitializationFailed,
141
+ critical: true,
142
+ });
143
+ }
144
+ /**
145
+ * Runs a new-style tool handler as a background task.
146
+ * Creates Context with `progress` and `signal`, stores result/error on completion.
147
+ */
148
+ async runAutoTaskHandler(tool, input, taskId, taskStore, services, formatter) {
149
+ const abortController = new AbortController();
150
+ // Poll for cancellation every 2 seconds
151
+ const cancelInterval = setInterval(async () => {
152
+ try {
153
+ const task = await taskStore.getTask(taskId);
154
+ if (task.status === 'cancelled') {
155
+ abortController.abort();
156
+ clearInterval(cancelInterval);
157
+ }
158
+ }
159
+ catch {
160
+ // Task may have been cleaned up — stop polling
161
+ clearInterval(cancelInterval);
162
+ }
163
+ }, 2000);
164
+ try {
165
+ const appContext = requestContextService.createRequestContext({
166
+ operation: 'AutoTaskHandler',
167
+ additionalContext: { toolName: tool.name, taskId },
168
+ });
169
+ // Check inline auth scopes
170
+ if (tool.auth && tool.auth.length > 0) {
171
+ withRequiredScopes(tool.auth, appContext);
172
+ }
173
+ const ctx = createContext({
174
+ appContext,
175
+ logger: services.logger,
176
+ storage: services.storage,
177
+ signal: abortController.signal,
178
+ taskCtx: { store: taskStore, taskId },
179
+ });
180
+ const result = await Promise.resolve(tool.handler(input, ctx));
181
+ clearInterval(cancelInterval);
182
+ await taskStore.storeTaskResult(taskId, 'completed', {
183
+ content: formatter(result),
184
+ structuredContent: result,
185
+ });
186
+ }
187
+ catch (error) {
188
+ clearInterval(cancelInterval);
189
+ // If cancelled, the SDK already set the terminal state — don't overwrite
190
+ if (abortController.signal.aborted)
191
+ return;
192
+ try {
193
+ const errorMessage = error instanceof Error ? error.message : String(error);
194
+ await taskStore.storeTaskResult(taskId, 'failed', {
195
+ content: [{ type: 'text', text: `Error: ${errorMessage}` }],
196
+ isError: true,
197
+ });
198
+ }
199
+ catch {
200
+ // Task may already be in terminal state
201
+ }
202
+ }
203
+ }
204
+ async registerTool(server, tool) {
205
+ const registrationContext = requestContextService.createRequestContext({
206
+ operation: 'ToolRegistry.registerTool',
207
+ toolName: tool.name,
208
+ });
209
+ logger.debug(`Registering tool: '${tool.name}'`, registrationContext);
210
+ await ErrorHandler.tryCatch(() => {
211
+ const handler = createMcpToolHandler({
212
+ toolName: tool.name,
213
+ inputSchema: tool.inputSchema,
214
+ logic: tool.logic,
215
+ ...(tool.responseFormatter && {
216
+ responseFormatter: tool.responseFormatter,
217
+ }),
218
+ });
219
+ const title = tool.title ?? tool.annotations?.title ?? this.deriveTitleFromName(tool.name);
220
+ // Type assertion required: SDK's conditional types don't resolve with generic constraints
221
+ server.registerTool(tool.name, {
222
+ title,
223
+ description: tool.description,
224
+ inputSchema: tool.inputSchema,
225
+ outputSchema: tool.outputSchema,
226
+ ...(tool.annotations && { annotations: tool.annotations }),
227
+ ...(tool._meta && { _meta: tool._meta }),
228
+ }, handler);
229
+ logger.notice(`Tool '${tool.name}' registered successfully.`, registrationContext);
230
+ }, {
231
+ operation: `RegisteringTool_${tool.name}`,
232
+ context: registrationContext,
233
+ errorCode: JsonRpcErrorCode.InitializationFailed,
234
+ critical: true,
235
+ });
236
+ }
237
+ /**
238
+ * Registers a task-based tool with the MCP server via the experimental Tasks API.
239
+ * Task tools support long-running async operations with polling for status and results.
240
+ *
241
+ * @experimental
242
+ */
243
+ async registerTaskTool(server, tool) {
244
+ const registrationContext = requestContextService.createRequestContext({
245
+ operation: 'ToolRegistry.registerTaskTool',
246
+ toolName: tool.name,
247
+ });
248
+ logger.debug(`Registering task tool: '${tool.name}' (experimental)`, registrationContext);
249
+ await ErrorHandler.tryCatch(() => {
250
+ const title = tool.title ?? tool.annotations?.title ?? this.deriveTitleFromName(tool.name);
251
+ // Use the experimental Tasks API to register task-based tools
252
+ server.experimental.tasks.registerToolTask(tool.name, {
253
+ title,
254
+ description: tool.description,
255
+ inputSchema: tool.inputSchema,
256
+ ...(tool.outputSchema && { outputSchema: tool.outputSchema }),
257
+ ...(tool.annotations && { annotations: tool.annotations }),
258
+ execution: tool.execution,
259
+ }, tool.taskHandlers);
260
+ logger.notice(`Task tool '${tool.name}' registered successfully (experimental).`, registrationContext);
261
+ }, {
262
+ operation: `RegisteringTaskTool_${tool.name}`,
263
+ context: registrationContext,
264
+ errorCode: JsonRpcErrorCode.InitializationFailed,
265
+ critical: true,
266
+ });
267
+ }
268
+ }
269
+ //# sourceMappingURL=tool-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,oBAAoB,GAErB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEL,mBAAmB,GACpB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,oBAAoB,GAErB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAQ3E,MAAM,OAAO,YAAY;IAEb;IACA;IAFV,YACU,QAAsB,EACtB,QAAiC;QADjC,aAAQ,GAAR,QAAQ,CAAc;QACtB,aAAQ,GAAR,QAAQ,CAAyB;IACxC,CAAC;IAEJ;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,MAAiB;QACxC,MAAM,OAAO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