@cyanheads/mcp-ts-core 0.11.4 → 0.12.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 (366) hide show
  1. package/AGENTS.md +28 -24
  2. package/CLAUDE.md +28 -24
  3. package/README.md +10 -10
  4. package/biome.json +1 -1
  5. package/changelog/0.11.x/0.11.5.md +28 -0
  6. package/changelog/0.12.x/0.12.0.md +96 -0
  7. package/changelog/template.md +55 -16
  8. package/dist/cli/init.js +1 -1
  9. package/dist/cli/init.js.map +1 -1
  10. package/dist/config/index.d.ts +0 -18
  11. package/dist/config/index.d.ts.map +1 -1
  12. package/dist/config/index.js +0 -25
  13. package/dist/config/index.js.map +1 -1
  14. package/dist/core/app.d.ts +5 -7
  15. package/dist/core/app.d.ts.map +1 -1
  16. package/dist/core/app.js +18 -27
  17. package/dist/core/app.js.map +1 -1
  18. package/dist/core/context.d.ts +90 -57
  19. package/dist/core/context.d.ts.map +1 -1
  20. package/dist/core/context.js +32 -33
  21. package/dist/core/context.js.map +1 -1
  22. package/dist/core/gcPressure.d.ts.map +1 -1
  23. package/dist/core/gcPressure.js +3 -4
  24. package/dist/core/gcPressure.js.map +1 -1
  25. package/dist/core/index.d.ts +6 -7
  26. package/dist/core/index.d.ts.map +1 -1
  27. package/dist/core/index.js +10 -2
  28. package/dist/core/index.js.map +1 -1
  29. package/dist/core/serverManifest.d.ts +1 -3
  30. package/dist/core/serverManifest.d.ts.map +1 -1
  31. package/dist/core/serverManifest.js +9 -4
  32. package/dist/core/serverManifest.js.map +1 -1
  33. package/dist/core/worker.d.ts.map +1 -1
  34. package/dist/core/worker.js +32 -35
  35. package/dist/core/worker.js.map +1 -1
  36. package/dist/logs/combined.log +10 -0
  37. package/dist/logs/error.log +6 -0
  38. package/dist/logs/interactions.log +0 -0
  39. package/dist/mcp-server/inputRequired.d.ts +52 -0
  40. package/dist/mcp-server/inputRequired.d.ts.map +1 -0
  41. package/dist/mcp-server/inputRequired.js +76 -0
  42. package/dist/mcp-server/inputRequired.js.map +1 -0
  43. package/dist/mcp-server/notifications.d.ts +33 -31
  44. package/dist/mcp-server/notifications.d.ts.map +1 -1
  45. package/dist/mcp-server/notifications.js +34 -26
  46. package/dist/mcp-server/notifications.js.map +1 -1
  47. package/dist/mcp-server/prompts/prompt-registration.d.ts +2 -2
  48. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
  49. package/dist/mcp-server/prompts/prompt-registration.js +15 -5
  50. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
  51. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +1 -1
  52. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -1
  53. package/dist/mcp-server/resources/resource-registration.d.ts +3 -3
  54. package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
  55. package/dist/mcp-server/resources/resource-registration.js +8 -15
  56. package/dist/mcp-server/resources/resource-registration.js.map +1 -1
  57. package/dist/mcp-server/resources/resourceSubscriptions.d.ts +45 -0
  58. package/dist/mcp-server/resources/resourceSubscriptions.d.ts.map +1 -0
  59. package/dist/mcp-server/resources/resourceSubscriptions.js +51 -0
  60. package/dist/mcp-server/resources/resourceSubscriptions.js.map +1 -0
  61. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +3 -5
  62. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -1
  63. package/dist/mcp-server/resources/utils/resourceDefinition.js +1 -1
  64. package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -1
  65. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +8 -15
  66. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
  67. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +21 -22
  68. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
  69. package/dist/mcp-server/server.d.ts +12 -21
  70. package/dist/mcp-server/server.d.ts.map +1 -1
  71. package/dist/mcp-server/server.js +38 -28
  72. package/dist/mcp-server/server.js.map +1 -1
  73. package/dist/mcp-server/tools/tool-registration.d.ts +11 -33
  74. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
  75. package/dist/mcp-server/tools/tool-registration.js +17 -243
  76. package/dist/mcp-server/tools/tool-registration.js.map +1 -1
  77. package/dist/mcp-server/tools/utils/toolDefinition.d.ts +1 -3
  78. package/dist/mcp-server/tools/utils/toolDefinition.d.ts.map +1 -1
  79. package/dist/mcp-server/tools/utils/toolDefinition.js +48 -1
  80. package/dist/mcp-server/tools/utils/toolDefinition.js.map +1 -1
  81. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +46 -20
  82. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  83. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +131 -25
  84. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  85. package/dist/mcp-server/transports/ITransport.d.ts +2 -2
  86. package/dist/mcp-server/transports/ITransport.d.ts.map +1 -1
  87. package/dist/mcp-server/transports/auth/authFactory.js +1 -1
  88. package/dist/mcp-server/transports/auth/authFactory.js.map +1 -1
  89. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +1 -1
  90. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -1
  91. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -1
  92. package/dist/mcp-server/transports/auth/lib/authUtils.js +5 -13
  93. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -1
  94. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +5 -11
  95. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -1
  96. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -1
  97. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +9 -22
  98. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -1
  99. package/dist/mcp-server/transports/heartbeat.d.ts.map +1 -1
  100. package/dist/mcp-server/transports/heartbeat.js +4 -8
  101. package/dist/mcp-server/transports/heartbeat.js.map +1 -1
  102. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -1
  103. package/dist/mcp-server/transports/http/httpErrorHandler.js +6 -24
  104. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -1
  105. package/dist/mcp-server/transports/http/httpServer.d.ts +3 -3
  106. package/dist/mcp-server/transports/http/httpServer.d.ts.map +1 -1
  107. package/dist/mcp-server/transports/http/httpServer.js +15 -32
  108. package/dist/mcp-server/transports/http/httpServer.js.map +1 -1
  109. package/dist/mcp-server/transports/http/httpTransport.d.ts +25 -8
  110. package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
  111. package/dist/mcp-server/transports/http/httpTransport.js +156 -310
  112. package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
  113. package/dist/mcp-server/transports/http/landing-page/assets/styles.d.ts.map +1 -1
  114. package/dist/mcp-server/transports/http/landing-page/assets/styles.js +0 -1
  115. package/dist/mcp-server/transports/http/landing-page/assets/styles.js.map +1 -1
  116. package/dist/mcp-server/transports/http/landing-page/handler.d.ts.map +1 -1
  117. package/dist/mcp-server/transports/http/landing-page/handler.js +4 -8
  118. package/dist/mcp-server/transports/http/landing-page/handler.js.map +1 -1
  119. package/dist/mcp-server/transports/http/landing-page/sections/tools.js +0 -2
  120. package/dist/mcp-server/transports/http/landing-page/sections/tools.js.map +1 -1
  121. package/dist/mcp-server/transports/http/protectedResourceMetadata.d.ts.map +1 -1
  122. package/dist/mcp-server/transports/http/protectedResourceMetadata.js +2 -6
  123. package/dist/mcp-server/transports/http/protectedResourceMetadata.js.map +1 -1
  124. package/dist/mcp-server/transports/http/robotsTxt.js +2 -2
  125. package/dist/mcp-server/transports/http/robotsTxt.js.map +1 -1
  126. package/dist/mcp-server/transports/http/serverCard.d.ts.map +1 -1
  127. package/dist/mcp-server/transports/http/serverCard.js +2 -6
  128. package/dist/mcp-server/transports/http/serverCard.js.map +1 -1
  129. package/dist/mcp-server/transports/http/sessionStore.d.ts +48 -45
  130. package/dist/mcp-server/transports/http/sessionStore.d.ts.map +1 -1
  131. package/dist/mcp-server/transports/http/sessionStore.js +141 -185
  132. package/dist/mcp-server/transports/http/sessionStore.js.map +1 -1
  133. package/dist/mcp-server/transports/manager.d.ts +12 -4
  134. package/dist/mcp-server/transports/manager.d.ts.map +1 -1
  135. package/dist/mcp-server/transports/manager.js +35 -33
  136. package/dist/mcp-server/transports/manager.js.map +1 -1
  137. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +24 -31
  138. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -1
  139. package/dist/mcp-server/transports/stdio/stdioTransport.js +23 -38
  140. package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -1
  141. package/dist/mcp-server/types.d.ts +25 -0
  142. package/dist/mcp-server/types.d.ts.map +1 -0
  143. package/dist/mcp-server/types.js +10 -0
  144. package/dist/mcp-server/types.js.map +1 -0
  145. package/dist/services/canvas/core/CanvasInstance.d.ts +2 -2
  146. package/dist/services/canvas/core/CanvasInstance.d.ts.map +1 -1
  147. package/dist/services/canvas/core/CanvasInstance.js.map +1 -1
  148. package/dist/services/canvas/core/CanvasRegistry.d.ts +4 -4
  149. package/dist/services/canvas/core/CanvasRegistry.d.ts.map +1 -1
  150. package/dist/services/canvas/core/CanvasRegistry.js +8 -18
  151. package/dist/services/canvas/core/CanvasRegistry.js.map +1 -1
  152. package/dist/services/canvas/core/DataCanvas.d.ts +5 -5
  153. package/dist/services/canvas/core/DataCanvas.d.ts.map +1 -1
  154. package/dist/services/canvas/core/DataCanvas.js +2 -3
  155. package/dist/services/canvas/core/DataCanvas.js.map +1 -1
  156. package/dist/services/canvas/core/IDataCanvasProvider.d.ts +11 -11
  157. package/dist/services/canvas/core/IDataCanvasProvider.d.ts.map +1 -1
  158. package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts +11 -11
  159. package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts.map +1 -1
  160. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js +4 -10
  161. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js.map +1 -1
  162. package/dist/services/llm/providers/openrouter.provider.d.ts.map +1 -1
  163. package/dist/services/llm/providers/openrouter.provider.js +2 -5
  164. package/dist/services/llm/providers/openrouter.provider.js.map +1 -1
  165. package/dist/services/mirror/core/defineMirror.js +1 -1
  166. package/dist/services/mirror/core/defineMirror.js.map +1 -1
  167. package/dist/services/mirror/types.d.ts +5 -5
  168. package/dist/services/mirror/types.d.ts.map +1 -1
  169. package/dist/services/speech/providers/elevenlabs.provider.js +1 -1
  170. package/dist/services/speech/providers/elevenlabs.provider.js.map +1 -1
  171. package/dist/services/speech/providers/whisper.provider.js +1 -1
  172. package/dist/services/speech/providers/whisper.provider.js.map +1 -1
  173. package/dist/storage/core/StorageService.d.ts +1 -1
  174. package/dist/storage/core/StorageService.d.ts.map +1 -1
  175. package/dist/storage/core/StorageService.js +12 -20
  176. package/dist/storage/core/StorageService.js.map +1 -1
  177. package/dist/storage/core/storageFactory.d.ts.map +1 -1
  178. package/dist/storage/core/storageFactory.js.map +1 -1
  179. package/dist/storage/core/storageValidation.d.ts +1 -1
  180. package/dist/storage/core/storageValidation.d.ts.map +1 -1
  181. package/dist/storage/core/storageValidation.js +2 -2
  182. package/dist/storage/core/storageValidation.js.map +1 -1
  183. package/dist/storage/providers/cloudflare/d1Provider.d.ts +1 -1
  184. package/dist/storage/providers/cloudflare/d1Provider.d.ts.map +1 -1
  185. package/dist/storage/providers/cloudflare/d1Provider.js +4 -12
  186. package/dist/storage/providers/cloudflare/d1Provider.js.map +1 -1
  187. package/dist/storage/providers/cloudflare/kvProvider.d.ts +1 -1
  188. package/dist/storage/providers/cloudflare/kvProvider.d.ts.map +1 -1
  189. package/dist/storage/providers/cloudflare/kvProvider.js +3 -8
  190. package/dist/storage/providers/cloudflare/kvProvider.js.map +1 -1
  191. package/dist/storage/providers/cloudflare/r2Provider.d.ts +1 -1
  192. package/dist/storage/providers/cloudflare/r2Provider.d.ts.map +1 -1
  193. package/dist/storage/providers/cloudflare/r2Provider.js +3 -8
  194. package/dist/storage/providers/cloudflare/r2Provider.js.map +1 -1
  195. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts +1 -1
  196. package/dist/storage/providers/inMemory/inMemoryProvider.d.ts.map +1 -1
  197. package/dist/storage/providers/inMemory/inMemoryProvider.js +2 -4
  198. package/dist/storage/providers/inMemory/inMemoryProvider.js.map +1 -1
  199. package/dist/testing/index.d.ts +35 -12
  200. package/dist/testing/index.d.ts.map +1 -1
  201. package/dist/testing/index.js +53 -38
  202. package/dist/testing/index.js.map +1 -1
  203. package/dist/testing/vitest.d.ts +1 -1
  204. package/dist/testing/vitest.d.ts.map +1 -1
  205. package/dist/types-global/errors.d.ts +28 -15
  206. package/dist/types-global/errors.d.ts.map +1 -1
  207. package/dist/types-global/errors.js +8 -1
  208. package/dist/types-global/errors.js.map +1 -1
  209. package/dist/utils/formatting/diffFormatter.d.ts +5 -5
  210. package/dist/utils/formatting/diffFormatter.d.ts.map +1 -1
  211. package/dist/utils/formatting/diffFormatter.js +7 -20
  212. package/dist/utils/formatting/diffFormatter.js.map +1 -1
  213. package/dist/utils/formatting/tableFormatter.d.ts +3 -3
  214. package/dist/utils/formatting/tableFormatter.d.ts.map +1 -1
  215. package/dist/utils/formatting/tableFormatter.js +6 -17
  216. package/dist/utils/formatting/tableFormatter.js.map +1 -1
  217. package/dist/utils/formatting/treeFormatter.d.ts +3 -3
  218. package/dist/utils/formatting/treeFormatter.d.ts.map +1 -1
  219. package/dist/utils/formatting/treeFormatter.js +5 -18
  220. package/dist/utils/formatting/treeFormatter.js.map +1 -1
  221. package/dist/utils/index.d.ts +4 -2
  222. package/dist/utils/index.d.ts.map +1 -1
  223. package/dist/utils/index.js +2 -2
  224. package/dist/utils/index.js.map +1 -1
  225. package/dist/utils/internal/error-handler/errorHandler.d.ts +1 -1
  226. package/dist/utils/internal/error-handler/errorHandler.d.ts.map +1 -1
  227. package/dist/utils/internal/error-handler/errorHandler.js +23 -11
  228. package/dist/utils/internal/error-handler/errorHandler.js.map +1 -1
  229. package/dist/utils/internal/error-handler/types.d.ts +10 -13
  230. package/dist/utils/internal/error-handler/types.d.ts.map +1 -1
  231. package/dist/utils/internal/logger.d.ts +3 -3
  232. package/dist/utils/internal/logger.d.ts.map +1 -1
  233. package/dist/utils/internal/logger.js +11 -5
  234. package/dist/utils/internal/logger.js.map +1 -1
  235. package/dist/utils/internal/performance.d.ts +1 -1
  236. package/dist/utils/internal/performance.d.ts.map +1 -1
  237. package/dist/utils/internal/performance.js +57 -13
  238. package/dist/utils/internal/performance.js.map +1 -1
  239. package/dist/utils/internal/requestContext.d.ts +79 -55
  240. package/dist/utils/internal/requestContext.d.ts.map +1 -1
  241. package/dist/utils/internal/requestContext.js +77 -32
  242. package/dist/utils/internal/requestContext.js.map +1 -1
  243. package/dist/utils/metrics/tokenCounter.d.ts +3 -3
  244. package/dist/utils/metrics/tokenCounter.d.ts.map +1 -1
  245. package/dist/utils/metrics/tokenCounter.js.map +1 -1
  246. package/dist/utils/network/fetchWithTimeout.d.ts +2 -2
  247. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
  248. package/dist/utils/network/fetchWithTimeout.js +8 -24
  249. package/dist/utils/network/fetchWithTimeout.js.map +1 -1
  250. package/dist/utils/network/retry.d.ts +2 -2
  251. package/dist/utils/network/retry.d.ts.map +1 -1
  252. package/dist/utils/overflow/outlineOnOverflow.d.ts +1 -1
  253. package/dist/utils/overflow/outlineOnOverflow.d.ts.map +1 -1
  254. package/dist/utils/pagination/pagination.d.ts +3 -3
  255. package/dist/utils/pagination/pagination.d.ts.map +1 -1
  256. package/dist/utils/pagination/pagination.js +3 -3
  257. package/dist/utils/pagination/pagination.js.map +1 -1
  258. package/dist/utils/parsing/csvParser.d.ts +2 -2
  259. package/dist/utils/parsing/csvParser.d.ts.map +1 -1
  260. package/dist/utils/parsing/csvParser.js +4 -8
  261. package/dist/utils/parsing/csvParser.js.map +1 -1
  262. package/dist/utils/parsing/dateParser.d.ts +3 -3
  263. package/dist/utils/parsing/dateParser.d.ts.map +1 -1
  264. package/dist/utils/parsing/dateParser.js +3 -2
  265. package/dist/utils/parsing/dateParser.js.map +1 -1
  266. package/dist/utils/parsing/frontmatterParser.d.ts +2 -2
  267. package/dist/utils/parsing/frontmatterParser.d.ts.map +1 -1
  268. package/dist/utils/parsing/frontmatterParser.js +7 -10
  269. package/dist/utils/parsing/frontmatterParser.js.map +1 -1
  270. package/dist/utils/parsing/htmlExtractor.d.ts +2 -2
  271. package/dist/utils/parsing/htmlExtractor.d.ts.map +1 -1
  272. package/dist/utils/parsing/htmlExtractor.js +6 -11
  273. package/dist/utils/parsing/htmlExtractor.js.map +1 -1
  274. package/dist/utils/parsing/jsonParser.d.ts +2 -2
  275. package/dist/utils/parsing/jsonParser.d.ts.map +1 -1
  276. package/dist/utils/parsing/jsonParser.js +4 -8
  277. package/dist/utils/parsing/jsonParser.js.map +1 -1
  278. package/dist/utils/parsing/pdfParser.d.ts +10 -10
  279. package/dist/utils/parsing/pdfParser.d.ts.map +1 -1
  280. package/dist/utils/parsing/pdfParser.js +26 -89
  281. package/dist/utils/parsing/pdfParser.js.map +1 -1
  282. package/dist/utils/parsing/xmlParser.d.ts +2 -2
  283. package/dist/utils/parsing/xmlParser.d.ts.map +1 -1
  284. package/dist/utils/parsing/xmlParser.js +4 -8
  285. package/dist/utils/parsing/xmlParser.js.map +1 -1
  286. package/dist/utils/parsing/yamlParser.d.ts +2 -2
  287. package/dist/utils/parsing/yamlParser.d.ts.map +1 -1
  288. package/dist/utils/parsing/yamlParser.js +4 -8
  289. package/dist/utils/parsing/yamlParser.js.map +1 -1
  290. package/dist/utils/scheduling/scheduler.d.ts.map +1 -1
  291. package/dist/utils/scheduling/scheduler.js +5 -6
  292. package/dist/utils/scheduling/scheduler.js.map +1 -1
  293. package/dist/utils/security/rateLimiter.d.ts +2 -2
  294. package/dist/utils/security/rateLimiter.d.ts.map +1 -1
  295. package/dist/utils/security/rateLimiter.js +1 -1
  296. package/dist/utils/security/rateLimiter.js.map +1 -1
  297. package/dist/utils/telemetry/attributes.d.ts +23 -7
  298. package/dist/utils/telemetry/attributes.d.ts.map +1 -1
  299. package/dist/utils/telemetry/attributes.js +23 -10
  300. package/dist/utils/telemetry/attributes.js.map +1 -1
  301. package/dist/utils/telemetry/trace.d.ts +3 -3
  302. package/dist/utils/telemetry/trace.d.ts.map +1 -1
  303. package/dist/utils/telemetry/trace.js +4 -2
  304. package/dist/utils/telemetry/trace.js.map +1 -1
  305. package/package.json +22 -26
  306. package/scripts/lint-mcp.ts +1 -3
  307. package/scripts/lint-packaging.ts +1 -1
  308. package/skills/add-service/SKILL.md +2 -2
  309. package/skills/add-test/SKILL.md +42 -20
  310. package/skills/add-tool/SKILL.md +68 -19
  311. package/skills/api-canvas/SKILL.md +2 -2
  312. package/skills/api-config/SKILL.md +1 -11
  313. package/skills/api-context/SKILL.md +175 -111
  314. package/skills/api-linter/SKILL.md +2 -2
  315. package/skills/api-telemetry/SKILL.md +8 -12
  316. package/skills/api-testing/SKILL.md +53 -52
  317. package/skills/code-simplifier/SKILL.md +2 -2
  318. package/skills/design-mcp-server/SKILL.md +34 -18
  319. package/skills/field-test/SKILL.md +4 -2
  320. package/skills/git-wrapup/SKILL.md +3 -3
  321. package/skills/polish-docs-meta/SKILL.md +1 -1
  322. package/skills/polish-docs-meta/references/agent-protocol.md +2 -2
  323. package/skills/polish-docs-meta/references/readme.md +1 -1
  324. package/skills/release-and-publish/SKILL.md +3 -1
  325. package/skills/report-issue-framework/SKILL.md +2 -2
  326. package/skills/report-issue-local/SKILL.md +2 -2
  327. package/skills/security-pass/SKILL.md +16 -14
  328. package/templates/.github/CODE_OF_CONDUCT.md +28 -0
  329. package/templates/.github/CONTRIBUTING.md +50 -0
  330. package/templates/.github/SECURITY.md +24 -0
  331. package/templates/AGENTS.md +6 -6
  332. package/templates/CLAUDE.md +6 -6
  333. package/templates/changelog/template.md +55 -16
  334. package/templates/tests/resources/echo.resource.test.ts +16 -9
  335. package/dist/mcp-server/elicitation.d.ts +0 -64
  336. package/dist/mcp-server/elicitation.d.ts.map +0 -1
  337. package/dist/mcp-server/elicitation.js +0 -81
  338. package/dist/mcp-server/elicitation.js.map +0 -1
  339. package/dist/mcp-server/protocolSession.d.ts +0 -34
  340. package/dist/mcp-server/protocolSession.d.ts.map +0 -1
  341. package/dist/mcp-server/protocolSession.js +0 -13
  342. package/dist/mcp-server/protocolSession.js.map +0 -1
  343. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts +0 -53
  344. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.d.ts.map +0 -1
  345. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js +0 -65
  346. package/dist/mcp-server/tasks/core/evictingTaskMessageQueue.js.map +0 -1
  347. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts +0 -70
  348. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.d.ts.map +0 -1
  349. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js +0 -130
  350. package/dist/mcp-server/tasks/core/sessionAwareTaskStore.js.map +0 -1
  351. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts +0 -109
  352. package/dist/mcp-server/tasks/core/storageBackedTaskStore.d.ts.map +0 -1
  353. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js +0 -209
  354. package/dist/mcp-server/tasks/core/storageBackedTaskStore.js.map +0 -1
  355. package/dist/mcp-server/tasks/core/taskManager.d.ts +0 -91
  356. package/dist/mcp-server/tasks/core/taskManager.d.ts.map +0 -1
  357. package/dist/mcp-server/tasks/core/taskManager.js +0 -210
  358. package/dist/mcp-server/tasks/core/taskManager.js.map +0 -1
  359. package/dist/mcp-server/tasks/core/taskTypes.d.ts +0 -18
  360. package/dist/mcp-server/tasks/core/taskTypes.d.ts.map +0 -1
  361. package/dist/mcp-server/tasks/core/taskTypes.js +0 -20
  362. package/dist/mcp-server/tasks/core/taskTypes.js.map +0 -1
  363. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts +0 -101
  364. package/dist/mcp-server/tasks/utils/taskToolDefinition.d.ts.map +0 -1
  365. package/dist/mcp-server/tasks/utils/taskToolDefinition.js +0 -14
  366. package/dist/mcp-server/tasks/utils/taskToolDefinition.js.map +0 -1
@@ -1,11 +1,5 @@
1
- import { config } from '../../config/index.js';
2
- import { attachTypedFail, createContext } from '../../core/context.js';
3
- import { DEFAULT_AUTO_TASK_TTL_MS } from '../../mcp-server/tasks/core/taskTypes.js';
4
- import { isTaskToolDefinition, } from '../../mcp-server/tasks/utils/taskToolDefinition.js';
5
1
  import { getDisabledMetadata } from '../../mcp-server/tools/utils/disabled-tool.js';
6
- import { buildToolErrorResult, buildToolSuccessResult, classifyAndBuildToolErrorResult, createToolHandler, effectiveOutputSchema, } from '../../mcp-server/tools/utils/toolHandlerFactory.js';
7
- import { authContext } from '../../mcp-server/transports/auth/lib/authContext.js';
8
- import { withRequiredScopes } from '../../mcp-server/transports/auth/lib/authUtils.js';
2
+ import { advertisedOutputSchema, createToolHandler, } from '../../mcp-server/tools/utils/toolHandlerFactory.js';
9
3
  import { JsonRpcErrorCode } from '../../types-global/errors.js';
10
4
  import { ErrorHandler } from '../../utils/internal/error-handler/errorHandler.js';
11
5
  import { logger } from '../../utils/internal/logger.js';
@@ -19,38 +13,25 @@ export class ToolRegistry {
19
13
  this.toolDefs = toolDefs;
20
14
  this.services = services;
21
15
  }
22
- /**
23
- * Registers all tool definitions with the provided McpServer instance.
24
- * Automatically detects standard tools, auto-task tools (task: true),
25
- * and escape-hatch TaskToolDefinitions.
26
- */
27
- async registerAll(server, protocolSession) {
16
+ /** Registers all tool definitions with the provided McpServer instance. */
17
+ async registerAll(server, subscriptions) {
28
18
  // Reset per-server uniqueness tracking — registries are shared across
29
- // per-request McpServer instances in HTTP mode (GHSA-345p-7cg4-v4c7).
19
+ // per-request McpServer instances under HTTP serving.
30
20
  this.registeredNames.clear();
31
21
  // Per-server notifier closures targeting `server.send*ListChanged()`. Bound
32
22
  // once per registerAll() call — never mutated on a shared services object
33
- // (which would race under concurrent HTTP requests). The sync handler
34
- // factory prefers request-scoped notifiers (#135) and falls back to these;
35
- // the background auto-task path uses them directly (no request scope), so
36
- // those notifications deliver on stdio but drop under HTTP.
23
+ // (which would race under concurrent HTTP requests). The handler factory
24
+ // prefers request-scoped notifiers (#135) and falls back to these.
37
25
  const notifiers = {
38
- elicitInput: (params) => server.server.elicitInput(params),
39
- getClientCapabilities: () => protocolSession?.clientCapabilities ?? server.server.getClientCapabilities(),
40
26
  notifyPromptListChanged: () => server.sendPromptListChanged(),
41
27
  notifyResourceListChanged: () => server.sendResourceListChanged(),
42
- notifyResourceUpdated: (uri) => server.server.sendResourceUpdated({ uri }),
43
28
  notifyToolListChanged: () => server.sendToolListChanged(),
44
- requestScopedElicitation: protocolSession !== undefined,
45
- ...(protocolSession?.registerRequest && {
46
- registerRequest: protocolSession.registerRequest,
47
- }),
29
+ ...(subscriptions && { subscriptions }),
48
30
  };
49
31
  const context = requestContextService.createRequestContext({
50
32
  operation: 'ToolRegistry.registerAll',
51
33
  });
52
- const standardTools = [];
53
- const taskTools = [];
34
+ const tools = [];
54
35
  let disabledCount = 0;
55
36
  for (const def of this.toolDefs) {
56
37
  const disabled = getDisabledMetadata(def);
@@ -59,31 +40,15 @@ export class ToolRegistry {
59
40
  logger.debug(`Skipping MCP registration for disabled tool '${def.name}': ${disabled.reason}`, context);
60
41
  continue;
61
42
  }
62
- if (isTaskToolDefinition(def)) {
63
- taskTools.push(def);
64
- }
65
- else {
66
- standardTools.push(def);
67
- }
43
+ tools.push(def);
68
44
  }
69
45
  const disabledNote = disabledCount > 0 ? ` (${disabledCount} disabled, skipped)` : '';
70
- logger.debug(`Registering ${standardTools.length} regular tool(s) and ${taskTools.length} task tool(s)${disabledNote}...`, context);
71
- // The SDK only installs tools/list + tools/call handlers the first time a
72
- // non-task tool is registered. Initialize them up front so empty servers
73
- // and task-only servers still expose truthful MCP tool behavior.
74
- server.setToolRequestHandlers();
75
- // Register standard tools (regular and auto-task)
76
- for (const toolDef of standardTools) {
77
- if (toolDef.task) {
78
- await this.registerAutoTaskTool(server, toolDef, notifiers);
79
- }
80
- else {
81
- await this.registerTool(server, toolDef, notifiers);
82
- }
83
- }
84
- // Register escape-hatch task tools via experimental API
85
- for (const toolDef of taskTools) {
86
- await this.registerTaskTool(server, toolDef);
46
+ logger.debug(`Registering ${tools.length} tool(s)${disabledNote}...`, context);
47
+ // `tools/list` and `tools/call` are installed by the SDK from the declared
48
+ // `tools` capability, so a server with every tool disabled still answers
49
+ // `tools/list` with an empty array rather than `-32601`.
50
+ for (const toolDef of tools) {
51
+ await this.registerTool(server, toolDef, notifiers);
87
52
  }
88
53
  }
89
54
  /** Throws at startup if a tool with the same name was already registered. */
@@ -104,7 +69,7 @@ export class ToolRegistry {
104
69
  async registerTool(server, tool, notifiers) {
105
70
  const registrationContext = requestContextService.createRequestContext({
106
71
  operation: 'ToolRegistry.registerTool',
107
- toolName: tool.name,
72
+ additionalContext: { toolName: tool.name },
108
73
  });
109
74
  logger.debug(`Registering tool: '${tool.name}'`, registrationContext);
110
75
  this.assertUniqueName(tool.name);
@@ -119,7 +84,7 @@ export class ToolRegistry {
119
84
  title,
120
85
  description: tool.description,
121
86
  inputSchema: tool.input,
122
- outputSchema: effectiveOutputSchema(tool),
87
+ outputSchema: advertisedOutputSchema(tool),
123
88
  ...(tool.annotations && { annotations: tool.annotations }),
124
89
  ...(tool._meta && { _meta: tool._meta }),
125
90
  }, handler);
@@ -131,196 +96,5 @@ export class ToolRegistry {
131
96
  critical: true,
132
97
  });
133
98
  }
134
- /**
135
- * Registers a tool with `task: true` via the experimental Tasks API.
136
- * Auto-generates task handlers from the definition's `handler` function.
137
- * The framework manages the full task lifecycle: create, background run, store result.
138
- */
139
- async registerAutoTaskTool(server, tool, notifiers) {
140
- const registrationContext = requestContextService.createRequestContext({
141
- operation: 'ToolRegistry.registerAutoTaskTool',
142
- toolName: tool.name,
143
- });
144
- logger.debug(`Registering auto-task tool (task: true): '${tool.name}'`, registrationContext);
145
- this.assertUniqueName(tool.name);
146
- await ErrorHandler.tryCatch(() => {
147
- if (!this.services) {
148
- throw new Error(`Cannot register auto-task tool '${tool.name}': HandlerFactoryServices not provided to ToolRegistry`);
149
- }
150
- const services = this.services;
151
- const title = tool.title ?? tool.annotations?.title ?? this.deriveTitleFromName(tool.name);
152
- const taskTtlMs = config.tasks.defaultTtlMs ?? DEFAULT_AUTO_TASK_TTL_MS;
153
- const formatter = (result) => tool.format
154
- ? tool.format(result)
155
- : [{ type: 'text', text: JSON.stringify(result, null, 2) }];
156
- server.experimental.tasks.registerToolTask(tool.name, {
157
- title,
158
- description: tool.description,
159
- inputSchema: tool.input,
160
- outputSchema: effectiveOutputSchema(tool),
161
- ...(tool.annotations && { annotations: tool.annotations }),
162
- ...(tool._meta && { _meta: tool._meta }),
163
- execution: { taskSupport: 'optional' },
164
- }, {
165
- createTask: async (args, extra) => {
166
- // Capture auth info from the request's ALS before firing the
167
- // background handler — ALS is gone once we leave this scope.
168
- const callerAuth = authContext.getStore()?.authInfo;
169
- // Check inline auth scopes in the request path (inside ALS context)
170
- // before creating the task — not in the background handler.
171
- if (tool.auth && tool.auth.length > 0) {
172
- withRequiredScopes(tool.auth);
173
- }
174
- const validatedInput = tool.input.parse(args);
175
- const task = await extra.taskStore.createTask({
176
- ttl: taskTtlMs,
177
- pollInterval: 1000,
178
- });
179
- // Fire-and-forget: run handler in background
180
- void this.runAutoTaskHandler(tool, validatedInput, services, notifiers, formatter, {
181
- taskId: task.taskId,
182
- taskStore: extra.taskStore,
183
- ttlMs: taskTtlMs,
184
- callerAuth,
185
- });
186
- return { task };
187
- },
188
- getTask: async (_args, extra) => extra.taskStore.getTask(extra.taskId),
189
- getTaskResult: async (_args, extra) => (await extra.taskStore.getTaskResult(extra.taskId)),
190
- });
191
- logger.debug(`Auto-task tool '${tool.name}' registered successfully (experimental).`, registrationContext);
192
- }, {
193
- operation: `RegisteringAutoTaskTool_${tool.name}`,
194
- context: registrationContext,
195
- errorCode: JsonRpcErrorCode.InitializationFailed,
196
- critical: true,
197
- });
198
- }
199
- /**
200
- * Runs a tool handler as a background task.
201
- * Creates Context with `progress` and `signal`, stores result/error on completion.
202
- * Enforces a deadline matching the task entry TTL to prevent leaked resources.
203
- */
204
- async runAutoTaskHandler(tool, input, services, notifiers, formatter, opts) {
205
- const { taskId, taskStore, ttlMs, callerAuth } = opts;
206
- const abortController = new AbortController();
207
- // Enforce handler execution deadline matching the task entry TTL.
208
- // Uses setTimeout + AbortController for cross-runtime compatibility
209
- // (AbortSignal.timeout() can fail in Bun's stdio transport due to realm mismatch).
210
- const TIMEOUT_SENTINEL = Symbol.for('AUTO_TASK_TIMEOUT');
211
- const timeoutId = setTimeout(() => abortController.abort(TIMEOUT_SENTINEL), ttlMs);
212
- // Poll for cancellation every 2 seconds
213
- const cancelInterval = setInterval(async () => {
214
- try {
215
- const task = await taskStore.getTask(taskId);
216
- if (task.status === 'cancelled') {
217
- abortController.abort();
218
- }
219
- }
220
- catch {
221
- // Task may have been cleaned up — abort to unblock handler
222
- abortController.abort();
223
- }
224
- }, 2000);
225
- try {
226
- // Auth scopes are checked in createTask (inside the request's ALS context),
227
- // not here — this runs in a detached background context where ALS is gone.
228
- // We use the captured callerAuth to populate ctx.auth for identity access.
229
- const appContext = callerAuth
230
- ? requestContextService.withAuthInfo(callerAuth, {
231
- operation: 'AutoTaskHandler',
232
- toolName: tool.name,
233
- taskId,
234
- })
235
- : requestContextService.createRequestContext({
236
- operation: 'AutoTaskHandler',
237
- additionalContext: { toolName: tool.name, taskId },
238
- });
239
- // Mirror createToolHandler's ctx construction so auto-task handlers that
240
- // call `ctx.fail(...)` work — without `attachTypedFail` they would crash
241
- // with `ctx.fail is not a function` when the contract is declared.
242
- const ctx = attachTypedFail(createContext({
243
- appContext,
244
- logger: services.logger,
245
- storage: services.storage,
246
- signal: abortController.signal,
247
- taskCtx: { store: taskStore, taskId },
248
- notifyPromptListChanged: notifiers.notifyPromptListChanged,
249
- notifyResourceListChanged: notifiers.notifyResourceListChanged,
250
- notifyResourceUpdated: notifiers.notifyResourceUpdated,
251
- notifyToolListChanged: notifiers.notifyToolListChanged,
252
- }), tool.errors);
253
- const result = await Promise.resolve(tool.handler(input, ctx));
254
- const validatedResult = tool.output.parse(result);
255
- // Merge enrichment into structuredContent + append the content[] trailer,
256
- // mirroring the standard tool handler factory.
257
- const { content, structuredContent } = buildToolSuccessResult(tool, ctx, validatedResult, formatter(validatedResult));
258
- await taskStore.storeTaskResult(taskId, 'completed', { content, structuredContent });
259
- }
260
- catch (error) {
261
- // If cancelled, the SDK already set the terminal state — don't overwrite
262
- if (abortController.signal.aborted && abortController.signal.reason !== TIMEOUT_SENTINEL) {
263
- return;
264
- }
265
- // Route through ErrorHandler for OTel span, structured logging, and classification
266
- ErrorHandler.handleError(error, {
267
- operation: `auto-task:${tool.name}`,
268
- context: { taskId, toolName: tool.name },
269
- input,
270
- });
271
- try {
272
- const isTimeout = abortController.signal.reason === TIMEOUT_SENTINEL;
273
- const result = isTimeout
274
- ? buildToolErrorResult(JsonRpcErrorCode.Timeout, `Task timed out after ${ttlMs}ms`, undefined)
275
- : classifyAndBuildToolErrorResult(error);
276
- await taskStore.storeTaskResult(taskId, 'failed', result);
277
- }
278
- catch {
279
- // Task may already be in terminal state
280
- }
281
- }
282
- finally {
283
- clearTimeout(timeoutId);
284
- clearInterval(cancelInterval);
285
- // Ensure abort controller is released — signals any lingering listeners
286
- if (!abortController.signal.aborted) {
287
- abortController.abort();
288
- }
289
- }
290
- }
291
- /**
292
- * Registers a task-based tool with the MCP server via the experimental Tasks API.
293
- * Task tools support long-running async operations with polling for status and results.
294
- *
295
- * @experimental
296
- */
297
- async registerTaskTool(server, tool) {
298
- const registrationContext = requestContextService.createRequestContext({
299
- operation: 'ToolRegistry.registerTaskTool',
300
- toolName: tool.name,
301
- });
302
- logger.debug(`Registering task tool: '${tool.name}' (experimental)`, registrationContext);
303
- this.assertUniqueName(tool.name);
304
- await ErrorHandler.tryCatch(() => {
305
- const title = tool.title ?? tool.annotations?.title ?? this.deriveTitleFromName(tool.name);
306
- // TaskToolDefinition is the escape hatch for fully-custom task lifecycle
307
- // and does not declare an `errors[]` contract — `_meta` flows through unchanged.
308
- server.experimental.tasks.registerToolTask(tool.name, {
309
- title,
310
- description: tool.description,
311
- inputSchema: tool.input,
312
- ...(tool.output && { outputSchema: tool.output }),
313
- ...(tool.annotations && { annotations: tool.annotations }),
314
- ...(tool._meta && { _meta: tool._meta }),
315
- execution: tool.execution,
316
- }, tool.taskHandlers);
317
- logger.debug(`Task tool '${tool.name}' registered successfully (experimental).`, registrationContext);
318
- }, {
319
- operation: `RegisteringTaskTool_${tool.name}`,
320
- context: registrationContext,
321
- errorCode: JsonRpcErrorCode.InitializationFailed,
322
- critical: true,
323
- });
324
- }
325
99
  }
326
100
  //# sourceMappingURL=tool-registration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EACL,oBAAoB,GAErB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,+BAA+B,EAC/B,iBAAiB,EACjB,qBAAqB,GAGtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAE9E,OAAO,EAAE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AC,EACD;YACE,SAAS,EAAE,uBAAuB,IAAI,CAAC,IAAI,EAAE;YAC7C,OAAO,EAAE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"tool-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAGlB,MAAM,gDAAgD,CAAC;AACxD,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;AAU3E,MAAM,OAAO,YAAY;IAKb,QAAQ;IACR,QAAQ;IALlB,oEAAoE;IACnD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,QAAsB,EACtB,QAAiC;wBADjC,QAAQ;wBACR,QAAQ;IACf,CAAC;IAEJ,2EAA2E;IACpE,KAAK,CAAC,WAAW,CACtB,MAAiB,EACjB,aAAqC;QAErC,sEAAsE;QACtE,sDAAsD;QACtD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,4EAA4E;QAC5E,0EAA0E;QAC1E,yEAAyE;QACzE,mEAAmE;QACnE,MAAM,SAAS,GAAqB;YAClC,uBAAuB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,EAAE;YAC7D,yBAAyB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE;YACjE,qBAAqB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE;YACzD,GAAG,CAAC,aAAa,IA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,CAAC;gBAC1C,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;gBAC1D,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;aACzC,EACD,OAA0C,CAC3C,CAAC;YAEF,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QACpF,CAAC,EACD;YACE,SAAS,EAAE,mBAAmB,IAAI,CAAC,IAAI,EAAE;YACzC,OAAO,EAAE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -7,7 +7,7 @@
7
7
  * import the wrapper from the same `/tools` subpath as the builder.
8
8
  * @module src/mcp-server/tools/utils/toolDefinition
9
9
  */
10
- import type { ContentBlock } from '@modelcontextprotocol/sdk/types.js';
10
+ import type { ContentBlock } from '@modelcontextprotocol/server';
11
11
  import type { ZodObject, ZodRawShape, z } from 'zod';
12
12
  import type { HandlerContext, ReasonOf } from '../../../core/context.js';
13
13
  import type { ErrorContract } from '../../../types-global/errors.js';
@@ -207,8 +207,6 @@ export interface ToolDefinition<TInput extends ZodObject<ZodRawShape> = ZodObjec
207
207
  * domain-namespaced subdirectories or a filename that doesn't mirror `name`).
208
208
  */
209
209
  sourceUrl?: string;
210
- /** When true, the framework manages task lifecycle automatically. */
211
- task?: boolean;
212
210
  /** Human-readable title for UI display. */
213
211
  title?: string;
214
212
  }
@@ -1 +1 @@
1
- {"version":3,"file":"toolDefinition.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/toolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAE,S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AAG,SAAS,EAEzD,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,GACvE,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAGnD"}
@@ -59,6 +59,53 @@ export { disabledTool } from './disabled-tool.js';
59
59
  * ```
60
60
  */
61
61
  export function tool(name, options) {
62
- return { name, ...options };
62
+ assertErrorKeyUnreserved(name, options.output, options.enrichment);
63
+ return { name, ...options, input: strictenInput(options.input) };
64
+ }
65
+ /**
66
+ * Rejects a definition whose success payload declares a field named `error`.
67
+ *
68
+ * `structuredContent.error` is the framework's failure envelope on the wire, so a
69
+ * success field of the same name cannot be told apart from a failure by any
70
+ * client. It also breaks the advertised schema outright: the envelope overwrites
71
+ * the declared field, while the success branch still requires — and forbids —
72
+ * the same key, leaving a branch no result can satisfy.
73
+ *
74
+ * Thrown at definition time, so the conflict surfaces at import rather than as a
75
+ * client-side validation failure against a schema nothing matches.
76
+ */
77
+ function assertErrorKeyUnreserved(name, output, enrichment) {
78
+ const source = 'error' in output.shape
79
+ ? 'output'
80
+ : enrichment && 'error' in enrichment
81
+ ? 'enrichment'
82
+ : undefined;
83
+ if (!source)
84
+ return;
85
+ throw new Error(`Tool '${name}' declares an 'error' field in its ${source} schema. That key is ` +
86
+ 'reserved: a failed call returns `structuredContent.error` ({ code, message, ' +
87
+ 'data }), so a success payload using it is indistinguishable from a failure. ' +
88
+ "Rename the field (e.g. 'errorText', 'failureDetail').");
89
+ }
90
+ /**
91
+ * Applies strict semantics to a tool's input schema.
92
+ *
93
+ * An unrecognized argument key is rejected instead of silently stripped, and
94
+ * the advertised `inputSchema` carries `additionalProperties: false` to match.
95
+ * Stripping turns a caller's misspelled key into a wrong answer they cannot
96
+ * detect: the value vanishes before the handler runs and the call fails
97
+ * downstream pointing at the wrong problem (#232).
98
+ *
99
+ * Only the default (strip) mode is upgraded. A definition that explicitly
100
+ * declared `.passthrough()` or `.catchall(...)` asked for an open object, and
101
+ * that intent wins — Zod records it as a catchall type, which is what this
102
+ * checks for.
103
+ *
104
+ * Root-level only, matching `.strict()` itself: a nested `z.object()` inside
105
+ * the input still strips unless it is strict in its own right.
106
+ */
107
+ function strictenInput(input) {
108
+ const declaresCatchall = input.def.catchall !== undefined;
109
+ return declaresCatchall ? input : input.strict();
63
110
  }
64
111
  //# sourceMappingURL=toolDefinition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/toolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAyB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAiOzE,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,UAAU,IAAI,CAMlB,IAAY,EACZ,OAAwE;IAExE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"file":"toolDefinition.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/toolDefinition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAyB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA+NzE,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,UAAU,IAAI,CAMlB,IAAY,EACZ,OAAwE;IAExE,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,wBAAwB,CAC/B,IAAY,EACZ,MAA8B,EAC9B,UAAmC;IAEnC,MAAM,MAAM,GACV,OAAO,IAAI,MAAM,CAAC,KAAK;QACrB,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,UAAU,IAAI,OAAO,IAAI,UAAU;YACnC,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,SAAS,CAAC;IAClB,IAAI,CAAC,MAAM;QAAE,OAAO;IACpB,MAAM,IAAI,KAAK,CACb,SAAS,IAAI,sCAAsC,MAAM,uBAAuB;QAC9E,8EAA8E;QAC9E,8EAA8E;QAC9E,uDAAuD,CAC1D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,aAAa,CAAwC,KAAa;IACzE,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC;IAC1D,OAAO,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,KAAK,CAAC,MAAM,EAAa,CAAC;AAC/D,CAAC"}
@@ -3,17 +3,14 @@
3
3
  * Constructs Context, checks inline auth, measures execution, formats response.
4
4
  * @module src/mcp-server/tools/utils/toolHandlerFactory
5
5
  */
6
- import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
7
- import type { CallToolResult, ContentBlock, ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types.js';
6
+ import type { CallToolResult, ContentBlock, InputRequiredResult, ServerContext } from '@modelcontextprotocol/server';
8
7
  import { type ZodObject, type ZodRawShape } from 'zod';
9
8
  import type { Context } from '../../../core/context.js';
10
- import { type ElicitationNotifiers } from '../../../mcp-server/elicitation.js';
11
- import type { ProtocolRequestRegistration } from '../../../mcp-server/protocolSession.js';
9
+ import { type ResourceSubscriptions } from '../../../mcp-server/notifications.js';
12
10
  import type { StorageService } from '../../../storage/core/StorageService.js';
13
11
  import { type JsonRpcErrorCode } from '../../../types-global/errors.js';
14
12
  import type { Logger } from '../../../utils/internal/logger.js';
15
13
  import type { AnyToolDefinition } from './toolDefinition.js';
16
- type SdkExtra = RequestHandlerExtra<ServerRequest, ServerNotification>;
17
14
  /** Services required by the handler factory to construct Context. */
18
15
  export interface HandlerFactoryServices {
19
16
  /**
@@ -28,27 +25,24 @@ export interface HandlerFactoryServices {
28
25
  }
29
26
  /**
30
27
  * Per-server notifier closures bound at registration time, targeting
31
- * `server.send*ListChanged()` and `server.server.elicitInput(...)`.
28
+ * `server.send*ListChanged()`.
32
29
  *
33
30
  * Split from {@link HandlerFactoryServices} so each per-request McpServer gets
34
31
  * its own notifier closures — preventing a concurrent registerAll() from
35
32
  * overwriting an in-flight handler's notifier target (and potentially
36
33
  * notifying the wrong server).
37
34
  *
38
- * The sync handler factory prefers request-scoped notifiers
39
- * ({@link buildRequestScopedNotifiers}, #135) and uses these only as a fallback;
40
- * the background auto-task path uses them directly (no request scope), so those
41
- * notifications deliver on stdio but drop under HTTP.
42
- *
43
- * The elicitation fields come from {@link ElicitationNotifiers}.
35
+ * The handler factory prefers request-scoped notifiers
36
+ * ({@link buildRequestScopedNotifiers}, #135) and uses these only as a fallback
37
+ * for scopes with no `ctx.mcpReq.notify` (test harnesses, background callers).
44
38
  */
45
- export interface HandlerNotifiers extends ElicitationNotifiers {
39
+ export interface HandlerNotifiers {
46
40
  notifyPromptListChanged?: () => void;
47
41
  notifyResourceListChanged?: () => void;
48
42
  notifyResourceUpdated?: (uri: string) => void;
49
43
  notifyToolListChanged?: () => void;
50
- /** Registers this handler invocation for session-scoped HTTP cancellation. */
51
- registerRequest?: (requestId: SdkExtra['requestId']) => ProtocolRequestRegistration;
44
+ /** Per-connection `resources/subscribe` registry (#354). */
45
+ subscriptions?: ResourceSubscriptions;
52
46
  }
53
47
  /**
54
48
  * Shapes a `CallToolResult` for a tool error response with parity across both
@@ -78,11 +72,44 @@ export declare function buildToolErrorResult(code: JsonRpcErrorCode, message: st
78
72
  */
79
73
  export declare function classifyAndBuildToolErrorResult(error: unknown): CallToolResult;
80
74
  /**
81
- * The output schema advertised to clients in `tools/list`. When a tool declares
82
- * an `enrichment` block, that's `output.extend(enrichment)` so enrichment fields
83
- * appear in the advertised `outputSchema`; otherwise the bare `output`.
75
+ * The schema the framework **parses** a successful result against: the declared
76
+ * `output`, extended with the `enrichment` block when one is declared. Strict by
77
+ * construction — a required enrichment field the handler never populated fails
78
+ * here, surfacing the authoring bug loudly.
79
+ *
80
+ * This is deliberately *not* what is advertised — see
81
+ * {@link advertisedOutputSchema}.
84
82
  */
85
83
  export declare function effectiveOutputSchema(def: AnyToolDefinition): ZodObject<ZodRawShape>;
84
+ /**
85
+ * The `outputSchema` advertised to clients in `tools/list` — every success field
86
+ * made optional, plus a declared `error` property (#241).
87
+ *
88
+ * A tool that fails returns `structuredContent: { error: … }`, which can never
89
+ * satisfy a success-only schema. Clients shipping an SDK whose `callTool()`
90
+ * validates `structuredContent` without first checking `isError` (every v1
91
+ * client, and every caller pinned to one) reject that envelope with `-32602`
92
+ * before the `isError` result reaches the agent. Widening the advertised schema
93
+ * is the only fix a server can ship, because the validator runs in the caller.
94
+ *
95
+ * **The root stays `type: 'object'`.** A discriminated union is the natural
96
+ * expression of success-or-error and is a trap: it emits `anyOf` with no `type`,
97
+ * which SEP-2106's legacy projection classifies as a non-object root and
98
+ * rewrites to `{ result: <natural> }` for every 2025-era client — silently
99
+ * breaking the *success* path for existing consumers to fix the error path.
100
+ *
101
+ * The cost of the object form is that `required` drops. An `anyOf` refinement
102
+ * carried in schema metadata recovers it: a result must satisfy either the
103
+ * success branch (success fields present, no `error`) or the failure branch
104
+ * (`error` present). `type: 'object'` is still there, so the projection does not
105
+ * trip, and `{}` — a handler that returned nothing — is rejected, which the
106
+ * success-only schema never caught either.
107
+ *
108
+ * Emission only. {@link buildToolSuccessResult} keeps parsing against
109
+ * {@link effectiveOutputSchema}, so the required-enrichment authoring check is
110
+ * unaffected.
111
+ */
112
+ export declare function advertisedOutputSchema(def: AnyToolDefinition): ZodObject<ZodRawShape>;
86
113
  /**
87
114
  * Shapes the success `CallToolResult` surfaces from the validated domain payload
88
115
  * plus any accumulated enrichment:
@@ -110,6 +137,5 @@ export declare function buildToolSuccessResult(def: AnyToolDefinition, ctx: Cont
110
137
  * - Formats response via `format` or JSON default
111
138
  * - Catches errors and returns `isError: true`
112
139
  */
113
- export declare function createToolHandler(def: AnyToolDefinition, services: HandlerFactoryServices, notifiers: HandlerNotifiers): (input: Record<string, unknown>, extra: SdkExtra) => Promise<CallToolResult>;
114
- export {};
140
+ export declare function createToolHandler(def: AnyToolDefinition, services: HandlerFactoryServices, notifiers: HandlerNotifiers): (input: Record<string, unknown>, ctx: ServerContext) => Promise<CallToolResult | InputRequiredResult>;
115
141
  //# sourceMappingURL=toolHandlerFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolHandlerFactory.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/toolHandlerFactory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACxF,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAY,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,KAAK,CAAC;AAGjE,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,mBAAmB,CAAC;AAOlE,OAAO,EAAE,KAAK,oBAAoB,EAAc,MAAM,6BAA6B,CAAC;AAEpF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAEnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,KAAK,gBAAgB,EAAY,MAAM,0BAA0B,CAAC;AAE3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BA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