@ibm/ibmi-mcp-server 0.1.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 (482) hide show
  1. package/README.md +88 -0
  2. package/dist/config/index.d.ts +100 -0
  3. package/dist/config/index.d.ts.map +1 -0
  4. package/dist/config/index.js +463 -0
  5. package/dist/config/index.js.map +1 -0
  6. package/dist/config/resolver.d.ts +32 -0
  7. package/dist/config/resolver.d.ts.map +1 -0
  8. package/dist/config/resolver.js +60 -0
  9. package/dist/config/resolver.js.map +1 -0
  10. package/dist/ibmi-mcp-server/auth/crypto.d.ts +11 -0
  11. package/dist/ibmi-mcp-server/auth/crypto.d.ts.map +1 -0
  12. package/dist/ibmi-mcp-server/auth/crypto.js +100 -0
  13. package/dist/ibmi-mcp-server/auth/crypto.js.map +1 -0
  14. package/dist/ibmi-mcp-server/auth/httpAuthEndpoint.d.ts +28 -0
  15. package/dist/ibmi-mcp-server/auth/httpAuthEndpoint.d.ts.map +1 -0
  16. package/dist/ibmi-mcp-server/auth/httpAuthEndpoint.js +243 -0
  17. package/dist/ibmi-mcp-server/auth/httpAuthEndpoint.js.map +1 -0
  18. package/dist/ibmi-mcp-server/auth/index.d.ts +9 -0
  19. package/dist/ibmi-mcp-server/auth/index.d.ts.map +1 -0
  20. package/dist/ibmi-mcp-server/auth/index.js +8 -0
  21. package/dist/ibmi-mcp-server/auth/index.js.map +1 -0
  22. package/dist/ibmi-mcp-server/auth/tokenManager.d.ts +86 -0
  23. package/dist/ibmi-mcp-server/auth/tokenManager.d.ts.map +1 -0
  24. package/dist/ibmi-mcp-server/auth/tokenManager.js +214 -0
  25. package/dist/ibmi-mcp-server/auth/tokenManager.js.map +1 -0
  26. package/dist/ibmi-mcp-server/auth/types.d.ts +31 -0
  27. package/dist/ibmi-mcp-server/auth/types.d.ts.map +1 -0
  28. package/dist/ibmi-mcp-server/auth/types.js +5 -0
  29. package/dist/ibmi-mcp-server/auth/types.js.map +1 -0
  30. package/dist/ibmi-mcp-server/index.d.ts +8 -0
  31. package/dist/ibmi-mcp-server/index.d.ts.map +1 -0
  32. package/dist/ibmi-mcp-server/index.js +126 -0
  33. package/dist/ibmi-mcp-server/index.js.map +1 -0
  34. package/dist/ibmi-mcp-server/resources/toolsetsResource/index.d.ts +7 -0
  35. package/dist/ibmi-mcp-server/resources/toolsetsResource/index.d.ts.map +1 -0
  36. package/dist/ibmi-mcp-server/resources/toolsetsResource/index.js +7 -0
  37. package/dist/ibmi-mcp-server/resources/toolsetsResource/index.js.map +1 -0
  38. package/dist/ibmi-mcp-server/resources/toolsetsResource/logic.d.ts +106 -0
  39. package/dist/ibmi-mcp-server/resources/toolsetsResource/logic.d.ts.map +1 -0
  40. package/dist/ibmi-mcp-server/resources/toolsetsResource/logic.js +145 -0
  41. package/dist/ibmi-mcp-server/resources/toolsetsResource/logic.js.map +1 -0
  42. package/dist/ibmi-mcp-server/resources/toolsetsResource/registration.d.ts +16 -0
  43. package/dist/ibmi-mcp-server/resources/toolsetsResource/registration.d.ts.map +1 -0
  44. package/dist/ibmi-mcp-server/resources/toolsetsResource/registration.js +110 -0
  45. package/dist/ibmi-mcp-server/resources/toolsetsResource/registration.js.map +1 -0
  46. package/dist/ibmi-mcp-server/schemas/common.d.ts +174 -0
  47. package/dist/ibmi-mcp-server/schemas/common.d.ts.map +1 -0
  48. package/dist/ibmi-mcp-server/schemas/common.js +119 -0
  49. package/dist/ibmi-mcp-server/schemas/common.js.map +1 -0
  50. package/dist/ibmi-mcp-server/schemas/config.d.ts +858 -0
  51. package/dist/ibmi-mcp-server/schemas/config.d.ts.map +1 -0
  52. package/dist/ibmi-mcp-server/schemas/config.js +248 -0
  53. package/dist/ibmi-mcp-server/schemas/config.js.map +1 -0
  54. package/dist/ibmi-mcp-server/schemas/index.d.ts +12 -0
  55. package/dist/ibmi-mcp-server/schemas/index.d.ts.map +1 -0
  56. package/dist/ibmi-mcp-server/schemas/index.js +20 -0
  57. package/dist/ibmi-mcp-server/schemas/index.js.map +1 -0
  58. package/dist/ibmi-mcp-server/schemas/tools.d.ts +287 -0
  59. package/dist/ibmi-mcp-server/schemas/tools.d.ts.map +1 -0
  60. package/dist/ibmi-mcp-server/schemas/tools.js +167 -0
  61. package/dist/ibmi-mcp-server/schemas/tools.js.map +1 -0
  62. package/dist/ibmi-mcp-server/services/authenticatedPoolManager.d.ts +82 -0
  63. package/dist/ibmi-mcp-server/services/authenticatedPoolManager.d.ts.map +1 -0
  64. package/dist/ibmi-mcp-server/services/authenticatedPoolManager.js +262 -0
  65. package/dist/ibmi-mcp-server/services/authenticatedPoolManager.js.map +1 -0
  66. package/dist/ibmi-mcp-server/services/baseConnectionPool.d.ts +130 -0
  67. package/dist/ibmi-mcp-server/services/baseConnectionPool.d.ts.map +1 -0
  68. package/dist/ibmi-mcp-server/services/baseConnectionPool.js +431 -0
  69. package/dist/ibmi-mcp-server/services/baseConnectionPool.js.map +1 -0
  70. package/dist/ibmi-mcp-server/services/connectionPool.d.ts +60 -0
  71. package/dist/ibmi-mcp-server/services/connectionPool.d.ts.map +1 -0
  72. package/dist/ibmi-mcp-server/services/connectionPool.js +153 -0
  73. package/dist/ibmi-mcp-server/services/connectionPool.js.map +1 -0
  74. package/dist/ibmi-mcp-server/services/securityValidation.d.ts +35 -0
  75. package/dist/ibmi-mcp-server/services/securityValidation.d.ts.map +1 -0
  76. package/dist/ibmi-mcp-server/services/securityValidation.js +93 -0
  77. package/dist/ibmi-mcp-server/services/securityValidation.js.map +1 -0
  78. package/dist/ibmi-mcp-server/services/sourceManager.d.ts +82 -0
  79. package/dist/ibmi-mcp-server/services/sourceManager.d.ts.map +1 -0
  80. package/dist/ibmi-mcp-server/services/sourceManager.js +151 -0
  81. package/dist/ibmi-mcp-server/services/sourceManager.js.map +1 -0
  82. package/dist/ibmi-mcp-server/tools/executeSql/index.d.ts +9 -0
  83. package/dist/ibmi-mcp-server/tools/executeSql/index.d.ts.map +1 -0
  84. package/dist/ibmi-mcp-server/tools/executeSql/index.js +9 -0
  85. package/dist/ibmi-mcp-server/tools/executeSql/index.js.map +1 -0
  86. package/dist/ibmi-mcp-server/tools/executeSql/logic.d.ts +51 -0
  87. package/dist/ibmi-mcp-server/tools/executeSql/logic.d.ts.map +1 -0
  88. package/dist/ibmi-mcp-server/tools/executeSql/logic.js +179 -0
  89. package/dist/ibmi-mcp-server/tools/executeSql/logic.js.map +1 -0
  90. package/dist/ibmi-mcp-server/tools/executeSql/registration.d.ts +52 -0
  91. package/dist/ibmi-mcp-server/tools/executeSql/registration.d.ts.map +1 -0
  92. package/dist/ibmi-mcp-server/tools/executeSql/registration.js +161 -0
  93. package/dist/ibmi-mcp-server/tools/executeSql/registration.js.map +1 -0
  94. package/dist/ibmi-mcp-server/tools/generateSql/index.d.ts +13 -0
  95. package/dist/ibmi-mcp-server/tools/generateSql/index.d.ts.map +1 -0
  96. package/dist/ibmi-mcp-server/tools/generateSql/index.js +13 -0
  97. package/dist/ibmi-mcp-server/tools/generateSql/index.js.map +1 -0
  98. package/dist/ibmi-mcp-server/tools/generateSql/logic.d.ts +64 -0
  99. package/dist/ibmi-mcp-server/tools/generateSql/logic.d.ts.map +1 -0
  100. package/dist/ibmi-mcp-server/tools/generateSql/logic.js +190 -0
  101. package/dist/ibmi-mcp-server/tools/generateSql/logic.js.map +1 -0
  102. package/dist/ibmi-mcp-server/tools/generateSql/registration.d.ts +18 -0
  103. package/dist/ibmi-mcp-server/tools/generateSql/registration.d.ts.map +1 -0
  104. package/dist/ibmi-mcp-server/tools/generateSql/registration.js +64 -0
  105. package/dist/ibmi-mcp-server/tools/generateSql/registration.js.map +1 -0
  106. package/dist/ibmi-mcp-server/utils/cli/argumentParser.d.ts +42 -0
  107. package/dist/ibmi-mcp-server/utils/cli/argumentParser.d.ts.map +1 -0
  108. package/dist/ibmi-mcp-server/utils/cli/argumentParser.js +156 -0
  109. package/dist/ibmi-mcp-server/utils/cli/argumentParser.js.map +1 -0
  110. package/dist/ibmi-mcp-server/utils/cli/index.d.ts +6 -0
  111. package/dist/ibmi-mcp-server/utils/cli/index.d.ts.map +1 -0
  112. package/dist/ibmi-mcp-server/utils/cli/index.js +6 -0
  113. package/dist/ibmi-mcp-server/utils/cli/index.js.map +1 -0
  114. package/dist/ibmi-mcp-server/utils/config/configParser.d.ts +77 -0
  115. package/dist/ibmi-mcp-server/utils/config/configParser.d.ts.map +1 -0
  116. package/dist/ibmi-mcp-server/utils/config/configParser.js +309 -0
  117. package/dist/ibmi-mcp-server/utils/config/configParser.js.map +1 -0
  118. package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.d.ts +143 -0
  119. package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.d.ts.map +1 -0
  120. package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.js +665 -0
  121. package/dist/ibmi-mcp-server/utils/config/toolConfigBuilder.js.map +1 -0
  122. package/dist/ibmi-mcp-server/utils/config/toolConfigCache.d.ts +71 -0
  123. package/dist/ibmi-mcp-server/utils/config/toolConfigCache.d.ts.map +1 -0
  124. package/dist/ibmi-mcp-server/utils/config/toolConfigCache.js +158 -0
  125. package/dist/ibmi-mcp-server/utils/config/toolConfigCache.js.map +1 -0
  126. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.d.ts +206 -0
  127. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.d.ts.map +1 -0
  128. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.js +236 -0
  129. package/dist/ibmi-mcp-server/utils/config/toolDefinitions.js.map +1 -0
  130. package/dist/ibmi-mcp-server/utils/config/toolFactory.d.ts +65 -0
  131. package/dist/ibmi-mcp-server/utils/config/toolFactory.d.ts.map +1 -0
  132. package/dist/ibmi-mcp-server/utils/config/toolFactory.js +236 -0
  133. package/dist/ibmi-mcp-server/utils/config/toolFactory.js.map +1 -0
  134. package/dist/ibmi-mcp-server/utils/config/toolProcessor.d.ts +175 -0
  135. package/dist/ibmi-mcp-server/utils/config/toolProcessor.d.ts.map +1 -0
  136. package/dist/ibmi-mcp-server/utils/config/toolProcessor.js +460 -0
  137. package/dist/ibmi-mcp-server/utils/config/toolProcessor.js.map +1 -0
  138. package/dist/ibmi-mcp-server/utils/config/toolsetManager.d.ts +126 -0
  139. package/dist/ibmi-mcp-server/utils/config/toolsetManager.d.ts.map +1 -0
  140. package/dist/ibmi-mcp-server/utils/config/toolsetManager.js +240 -0
  141. package/dist/ibmi-mcp-server/utils/config/toolsetManager.js.map +1 -0
  142. package/dist/ibmi-mcp-server/utils/config/types.d.ts +74 -0
  143. package/dist/ibmi-mcp-server/utils/config/types.d.ts.map +1 -0
  144. package/dist/ibmi-mcp-server/utils/config/types.js +8 -0
  145. package/dist/ibmi-mcp-server/utils/config/types.js.map +1 -0
  146. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.d.ts +116 -0
  147. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.d.ts.map +1 -0
  148. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.js +426 -0
  149. package/dist/ibmi-mcp-server/utils/security/sqlSecurityValidator.js.map +1 -0
  150. package/dist/ibmi-mcp-server/utils/sql/parameterProcessor.d.ts +182 -0
  151. package/dist/ibmi-mcp-server/utils/sql/parameterProcessor.d.ts.map +1 -0
  152. package/dist/ibmi-mcp-server/utils/sql/parameterProcessor.js +726 -0
  153. package/dist/ibmi-mcp-server/utils/sql/parameterProcessor.js.map +1 -0
  154. package/dist/ibmi-mcp-server/utils/sql/sqlTemplateProcessor.d.ts +90 -0
  155. package/dist/ibmi-mcp-server/utils/sql/sqlTemplateProcessor.d.ts.map +1 -0
  156. package/dist/ibmi-mcp-server/utils/sql/sqlTemplateProcessor.js +187 -0
  157. package/dist/ibmi-mcp-server/utils/sql/sqlTemplateProcessor.js.map +1 -0
  158. package/dist/index.d.ts +10 -0
  159. package/dist/index.d.ts.map +1 -0
  160. package/dist/index.js +270 -0
  161. package/dist/index.js.map +1 -0
  162. package/dist/mcp-server/constants.d.ts +13 -0
  163. package/dist/mcp-server/constants.d.ts.map +1 -0
  164. package/dist/mcp-server/constants.js +13 -0
  165. package/dist/mcp-server/constants.js.map +1 -0
  166. package/dist/mcp-server/logging/index.d.ts +8 -0
  167. package/dist/mcp-server/logging/index.d.ts.map +1 -0
  168. package/dist/mcp-server/logging/index.js +8 -0
  169. package/dist/mcp-server/logging/index.js.map +1 -0
  170. package/dist/mcp-server/logging/setLevelHandler.d.ts +38 -0
  171. package/dist/mcp-server/logging/setLevelHandler.d.ts.map +1 -0
  172. package/dist/mcp-server/logging/setLevelHandler.js +83 -0
  173. package/dist/mcp-server/logging/setLevelHandler.js.map +1 -0
  174. package/dist/mcp-server/resources/echoResource/index.d.ts +14 -0
  175. package/dist/mcp-server/resources/echoResource/index.d.ts.map +1 -0
  176. package/dist/mcp-server/resources/echoResource/index.js +14 -0
  177. package/dist/mcp-server/resources/echoResource/index.js.map +1 -0
  178. package/dist/mcp-server/resources/echoResource/logic.d.ts +37 -0
  179. package/dist/mcp-server/resources/echoResource/logic.d.ts.map +1 -0
  180. package/dist/mcp-server/resources/echoResource/logic.js +46 -0
  181. package/dist/mcp-server/resources/echoResource/logic.js.map +1 -0
  182. package/dist/mcp-server/resources/echoResource/registration.d.ts +7 -0
  183. package/dist/mcp-server/resources/echoResource/registration.d.ts.map +1 -0
  184. package/dist/mcp-server/resources/echoResource/registration.js +51 -0
  185. package/dist/mcp-server/resources/echoResource/registration.js.map +1 -0
  186. package/dist/mcp-server/resources/index.d.ts +10 -0
  187. package/dist/mcp-server/resources/index.d.ts.map +1 -0
  188. package/dist/mcp-server/resources/index.js +19 -0
  189. package/dist/mcp-server/resources/index.js.map +1 -0
  190. package/dist/mcp-server/resources/utils/resource-utils.d.ts +43 -0
  191. package/dist/mcp-server/resources/utils/resource-utils.d.ts.map +1 -0
  192. package/dist/mcp-server/resources/utils/resource-utils.js +44 -0
  193. package/dist/mcp-server/resources/utils/resource-utils.js.map +1 -0
  194. package/dist/mcp-server/server.d.ts +23 -0
  195. package/dist/mcp-server/server.d.ts.map +1 -0
  196. package/dist/mcp-server/server.js +114 -0
  197. package/dist/mcp-server/server.js.map +1 -0
  198. package/dist/mcp-server/tools/catFactFetcher/index.d.ts +8 -0
  199. package/dist/mcp-server/tools/catFactFetcher/index.d.ts.map +1 -0
  200. package/dist/mcp-server/tools/catFactFetcher/index.js +8 -0
  201. package/dist/mcp-server/tools/catFactFetcher/index.js.map +1 -0
  202. package/dist/mcp-server/tools/catFactFetcher/logic.d.ts +52 -0
  203. package/dist/mcp-server/tools/catFactFetcher/logic.d.ts.map +1 -0
  204. package/dist/mcp-server/tools/catFactFetcher/logic.js +95 -0
  205. package/dist/mcp-server/tools/catFactFetcher/logic.js.map +1 -0
  206. package/dist/mcp-server/tools/catFactFetcher/registration.d.ts +9 -0
  207. package/dist/mcp-server/tools/catFactFetcher/registration.d.ts.map +1 -0
  208. package/dist/mcp-server/tools/catFactFetcher/registration.js +43 -0
  209. package/dist/mcp-server/tools/catFactFetcher/registration.js.map +1 -0
  210. package/dist/mcp-server/tools/echoTool/index.d.ts +13 -0
  211. package/dist/mcp-server/tools/echoTool/index.d.ts.map +1 -0
  212. package/dist/mcp-server/tools/echoTool/index.js +13 -0
  213. package/dist/mcp-server/tools/echoTool/index.js.map +1 -0
  214. package/dist/mcp-server/tools/echoTool/logic.d.ts +69 -0
  215. package/dist/mcp-server/tools/echoTool/logic.d.ts.map +1 -0
  216. package/dist/mcp-server/tools/echoTool/logic.js +119 -0
  217. package/dist/mcp-server/tools/echoTool/logic.js.map +1 -0
  218. package/dist/mcp-server/tools/echoTool/registration.d.ts +9 -0
  219. package/dist/mcp-server/tools/echoTool/registration.d.ts.map +1 -0
  220. package/dist/mcp-server/tools/echoTool/registration.js +45 -0
  221. package/dist/mcp-server/tools/echoTool/registration.js.map +1 -0
  222. package/dist/mcp-server/tools/imageTest/index.d.ts +7 -0
  223. package/dist/mcp-server/tools/imageTest/index.d.ts.map +1 -0
  224. package/dist/mcp-server/tools/imageTest/index.js +7 -0
  225. package/dist/mcp-server/tools/imageTest/index.js.map +1 -0
  226. package/dist/mcp-server/tools/imageTest/logic.d.ts +27 -0
  227. package/dist/mcp-server/tools/imageTest/logic.d.ts.map +1 -0
  228. package/dist/mcp-server/tools/imageTest/logic.js +44 -0
  229. package/dist/mcp-server/tools/imageTest/logic.js.map +1 -0
  230. package/dist/mcp-server/tools/imageTest/registration.d.ts +9 -0
  231. package/dist/mcp-server/tools/imageTest/registration.d.ts.map +1 -0
  232. package/dist/mcp-server/tools/imageTest/registration.js +49 -0
  233. package/dist/mcp-server/tools/imageTest/registration.js.map +1 -0
  234. package/dist/mcp-server/tools/index.d.ts +4 -0
  235. package/dist/mcp-server/tools/index.d.ts.map +1 -0
  236. package/dist/mcp-server/tools/index.js +13 -0
  237. package/dist/mcp-server/tools/index.js.map +1 -0
  238. package/dist/mcp-server/tools/utils/tool-utils.d.ts +43 -0
  239. package/dist/mcp-server/tools/utils/tool-utils.d.ts.map +1 -0
  240. package/dist/mcp-server/tools/utils/tool-utils.js +44 -0
  241. package/dist/mcp-server/tools/utils/tool-utils.js.map +1 -0
  242. package/dist/mcp-server/transports/auth/authFactory.d.ts +11 -0
  243. package/dist/mcp-server/transports/auth/authFactory.d.ts.map +1 -0
  244. package/dist/mcp-server/transports/auth/authFactory.js +46 -0
  245. package/dist/mcp-server/transports/auth/authFactory.js.map +1 -0
  246. package/dist/mcp-server/transports/auth/authMiddleware.d.ts +20 -0
  247. package/dist/mcp-server/transports/auth/authMiddleware.d.ts.map +1 -0
  248. package/dist/mcp-server/transports/auth/authMiddleware.js +58 -0
  249. package/dist/mcp-server/transports/auth/authMiddleware.js.map +1 -0
  250. package/dist/mcp-server/transports/auth/index.d.ts +14 -0
  251. package/dist/mcp-server/transports/auth/index.d.ts.map +1 -0
  252. package/dist/mcp-server/transports/auth/index.js +12 -0
  253. package/dist/mcp-server/transports/auth/index.js.map +1 -0
  254. package/dist/mcp-server/transports/auth/lib/authContext.d.ts +34 -0
  255. package/dist/mcp-server/transports/auth/lib/authContext.d.ts.map +1 -0
  256. package/dist/mcp-server/transports/auth/lib/authContext.js +25 -0
  257. package/dist/mcp-server/transports/auth/lib/authContext.js.map +1 -0
  258. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts +15 -0
  259. package/dist/mcp-server/transports/auth/lib/authTypes.d.ts.map +1 -0
  260. package/dist/mcp-server/transports/auth/lib/authTypes.js +9 -0
  261. package/dist/mcp-server/transports/auth/lib/authTypes.js.map +1 -0
  262. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts +19 -0
  263. package/dist/mcp-server/transports/auth/lib/authUtils.d.ts.map +1 -0
  264. package/dist/mcp-server/transports/auth/lib/authUtils.js +53 -0
  265. package/dist/mcp-server/transports/auth/lib/authUtils.js.map +1 -0
  266. package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts +18 -0
  267. package/dist/mcp-server/transports/auth/strategies/authStrategy.d.ts.map +1 -0
  268. package/dist/mcp-server/transports/auth/strategies/authStrategy.js +2 -0
  269. package/dist/mcp-server/transports/auth/strategies/authStrategy.js.map +1 -0
  270. package/dist/mcp-server/transports/auth/strategies/ibmiTokenStrategy.d.ts +21 -0
  271. package/dist/mcp-server/transports/auth/strategies/ibmiTokenStrategy.d.ts.map +1 -0
  272. package/dist/mcp-server/transports/auth/strategies/ibmiTokenStrategy.js +64 -0
  273. package/dist/mcp-server/transports/auth/strategies/ibmiTokenStrategy.js.map +1 -0
  274. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts +8 -0
  275. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.d.ts.map +1 -0
  276. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js +118 -0
  277. package/dist/mcp-server/transports/auth/strategies/jwtStrategy.js.map +1 -0
  278. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts +8 -0
  279. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.d.ts.map +1 -0
  280. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js +118 -0
  281. package/dist/mcp-server/transports/auth/strategies/oauthStrategy.js.map +1 -0
  282. package/dist/mcp-server/transports/core/autoTransportManager.d.ts +48 -0
  283. package/dist/mcp-server/transports/core/autoTransportManager.d.ts.map +1 -0
  284. package/dist/mcp-server/transports/core/autoTransportManager.js +57 -0
  285. package/dist/mcp-server/transports/core/autoTransportManager.js.map +1 -0
  286. package/dist/mcp-server/transports/core/baseTransportManager.d.ts +17 -0
  287. package/dist/mcp-server/transports/core/baseTransportManager.d.ts.map +1 -0
  288. package/dist/mcp-server/transports/core/baseTransportManager.js +20 -0
  289. package/dist/mcp-server/transports/core/baseTransportManager.js.map +1 -0
  290. package/dist/mcp-server/transports/core/headerUtils.d.ts +27 -0
  291. package/dist/mcp-server/transports/core/headerUtils.d.ts.map +1 -0
  292. package/dist/mcp-server/transports/core/headerUtils.js +53 -0
  293. package/dist/mcp-server/transports/core/headerUtils.js.map +1 -0
  294. package/dist/mcp-server/transports/core/honoNodeBridge.d.ts +77 -0
  295. package/dist/mcp-server/transports/core/honoNodeBridge.d.ts.map +1 -0
  296. package/dist/mcp-server/transports/core/honoNodeBridge.js +150 -0
  297. package/dist/mcp-server/transports/core/honoNodeBridge.js.map +1 -0
  298. package/dist/mcp-server/transports/core/statefulTransportManager.d.ts +81 -0
  299. package/dist/mcp-server/transports/core/statefulTransportManager.d.ts.map +1 -0
  300. package/dist/mcp-server/transports/core/statefulTransportManager.js +326 -0
  301. package/dist/mcp-server/transports/core/statefulTransportManager.js.map +1 -0
  302. package/dist/mcp-server/transports/core/statelessTransportManager.d.ts +57 -0
  303. package/dist/mcp-server/transports/core/statelessTransportManager.d.ts.map +1 -0
  304. package/dist/mcp-server/transports/core/statelessTransportManager.js +151 -0
  305. package/dist/mcp-server/transports/core/statelessTransportManager.js.map +1 -0
  306. package/dist/mcp-server/transports/core/transportRequest.d.ts +9 -0
  307. package/dist/mcp-server/transports/core/transportRequest.d.ts.map +1 -0
  308. package/dist/mcp-server/transports/core/transportRequest.js +2 -0
  309. package/dist/mcp-server/transports/core/transportRequest.js.map +1 -0
  310. package/dist/mcp-server/transports/core/transportTypes.d.ts +112 -0
  311. package/dist/mcp-server/transports/core/transportTypes.d.ts.map +1 -0
  312. package/dist/mcp-server/transports/core/transportTypes.js +15 -0
  313. package/dist/mcp-server/transports/core/transportTypes.js.map +1 -0
  314. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts +25 -0
  315. package/dist/mcp-server/transports/http/httpErrorHandler.d.ts.map +1 -0
  316. package/dist/mcp-server/transports/http/httpErrorHandler.js +86 -0
  317. package/dist/mcp-server/transports/http/httpErrorHandler.js.map +1 -0
  318. package/dist/mcp-server/transports/http/httpTransport.d.ts +27 -0
  319. package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -0
  320. package/dist/mcp-server/transports/http/httpTransport.js +407 -0
  321. package/dist/mcp-server/transports/http/httpTransport.js.map +1 -0
  322. package/dist/mcp-server/transports/http/httpTypes.d.ts +17 -0
  323. package/dist/mcp-server/transports/http/httpTypes.d.ts.map +1 -0
  324. package/dist/mcp-server/transports/http/httpTypes.js +6 -0
  325. package/dist/mcp-server/transports/http/httpTypes.js.map +1 -0
  326. package/dist/mcp-server/transports/http/index.d.ts +8 -0
  327. package/dist/mcp-server/transports/http/index.d.ts.map +1 -0
  328. package/dist/mcp-server/transports/http/index.js +7 -0
  329. package/dist/mcp-server/transports/http/index.js.map +1 -0
  330. package/dist/mcp-server/transports/http/mcpTransportMiddleware.d.ts +21 -0
  331. package/dist/mcp-server/transports/http/mcpTransportMiddleware.d.ts.map +1 -0
  332. package/dist/mcp-server/transports/http/mcpTransportMiddleware.js +54 -0
  333. package/dist/mcp-server/transports/http/mcpTransportMiddleware.js.map +1 -0
  334. package/dist/mcp-server/transports/stdio/index.d.ts +6 -0
  335. package/dist/mcp-server/transports/stdio/index.d.ts.map +1 -0
  336. package/dist/mcp-server/transports/stdio/index.js +6 -0
  337. package/dist/mcp-server/transports/stdio/index.js.map +1 -0
  338. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts +43 -0
  339. package/dist/mcp-server/transports/stdio/stdioTransport.d.ts.map +1 -0
  340. package/dist/mcp-server/transports/stdio/stdioTransport.js +71 -0
  341. package/dist/mcp-server/transports/stdio/stdioTransport.js.map +1 -0
  342. package/dist/services/duck-db/duckDBConnectionManager.d.ts +55 -0
  343. package/dist/services/duck-db/duckDBConnectionManager.d.ts.map +1 -0
  344. package/dist/services/duck-db/duckDBConnectionManager.js +184 -0
  345. package/dist/services/duck-db/duckDBConnectionManager.js.map +1 -0
  346. package/dist/services/duck-db/duckDBQueryExecutor.d.ts +18 -0
  347. package/dist/services/duck-db/duckDBQueryExecutor.d.ts.map +1 -0
  348. package/dist/services/duck-db/duckDBQueryExecutor.js +115 -0
  349. package/dist/services/duck-db/duckDBQueryExecutor.js.map +1 -0
  350. package/dist/services/duck-db/duckDBService.d.ts +27 -0
  351. package/dist/services/duck-db/duckDBService.d.ts.map +1 -0
  352. package/dist/services/duck-db/duckDBService.js +151 -0
  353. package/dist/services/duck-db/duckDBService.js.map +1 -0
  354. package/dist/services/duck-db/types.d.ts +135 -0
  355. package/dist/services/duck-db/types.d.ts.map +1 -0
  356. package/dist/services/duck-db/types.js +6 -0
  357. package/dist/services/duck-db/types.js.map +1 -0
  358. package/dist/services/llm-providers/openRouterProvider.d.ts +36 -0
  359. package/dist/services/llm-providers/openRouterProvider.d.ts.map +1 -0
  360. package/dist/services/llm-providers/openRouterProvider.js +235 -0
  361. package/dist/services/llm-providers/openRouterProvider.js.map +1 -0
  362. package/dist/services/supabase/supabaseClient.d.ts +25 -0
  363. package/dist/services/supabase/supabaseClient.d.ts.map +1 -0
  364. package/dist/services/supabase/supabaseClient.js +68 -0
  365. package/dist/services/supabase/supabaseClient.js.map +1 -0
  366. package/dist/storage/duckdbExample.d.ts +8 -0
  367. package/dist/storage/duckdbExample.d.ts.map +1 -0
  368. package/dist/storage/duckdbExample.js +197 -0
  369. package/dist/storage/duckdbExample.js.map +1 -0
  370. package/dist/types-global/errors.d.ts +101 -0
  371. package/dist/types-global/errors.d.ts.map +1 -0
  372. package/dist/types-global/errors.js +109 -0
  373. package/dist/types-global/errors.js.map +1 -0
  374. package/dist/utils/formatting/index.d.ts +10 -0
  375. package/dist/utils/formatting/index.d.ts.map +1 -0
  376. package/dist/utils/formatting/index.js +10 -0
  377. package/dist/utils/formatting/index.js.map +1 -0
  378. package/dist/utils/formatting/markdownBuilder.d.ts +348 -0
  379. package/dist/utils/formatting/markdownBuilder.d.ts.map +1 -0
  380. package/dist/utils/formatting/markdownBuilder.js +501 -0
  381. package/dist/utils/formatting/markdownBuilder.js.map +1 -0
  382. package/dist/utils/formatting/sqlFormattingUtils.d.ts +69 -0
  383. package/dist/utils/formatting/sqlFormattingUtils.d.ts.map +1 -0
  384. package/dist/utils/formatting/sqlFormattingUtils.js +131 -0
  385. package/dist/utils/formatting/sqlFormattingUtils.js.map +1 -0
  386. package/dist/utils/formatting/tableFormatter.d.ts +268 -0
  387. package/dist/utils/formatting/tableFormatter.d.ts.map +1 -0
  388. package/dist/utils/formatting/tableFormatter.js +550 -0
  389. package/dist/utils/formatting/tableFormatter.js.map +1 -0
  390. package/dist/utils/index.d.ts +13 -0
  391. package/dist/utils/index.d.ts.map +1 -0
  392. package/dist/utils/index.js +21 -0
  393. package/dist/utils/index.js.map +1 -0
  394. package/dist/utils/internal/asyncContext.d.ts +35 -0
  395. package/dist/utils/internal/asyncContext.d.ts.map +1 -0
  396. package/dist/utils/internal/asyncContext.js +38 -0
  397. package/dist/utils/internal/asyncContext.js.map +1 -0
  398. package/dist/utils/internal/errorHandler.d.ts +95 -0
  399. package/dist/utils/internal/errorHandler.d.ts.map +1 -0
  400. package/dist/utils/internal/errorHandler.js +210 -0
  401. package/dist/utils/internal/errorHandler.js.map +1 -0
  402. package/dist/utils/internal/index.d.ts +12 -0
  403. package/dist/utils/internal/index.d.ts.map +1 -0
  404. package/dist/utils/internal/index.js +12 -0
  405. package/dist/utils/internal/index.js.map +1 -0
  406. package/dist/utils/internal/logger.d.ts +30 -0
  407. package/dist/utils/internal/logger.d.ts.map +1 -0
  408. package/dist/utils/internal/logger.js +228 -0
  409. package/dist/utils/internal/logger.js.map +1 -0
  410. package/dist/utils/internal/logging-helpers.d.ts +49 -0
  411. package/dist/utils/internal/logging-helpers.d.ts.map +1 -0
  412. package/dist/utils/internal/logging-helpers.js +60 -0
  413. package/dist/utils/internal/logging-helpers.js.map +1 -0
  414. package/dist/utils/internal/performance.d.ts +19 -0
  415. package/dist/utils/internal/performance.d.ts.map +1 -0
  416. package/dist/utils/internal/performance.js +110 -0
  417. package/dist/utils/internal/performance.js.map +1 -0
  418. package/dist/utils/internal/requestContext.d.ts +41 -0
  419. package/dist/utils/internal/requestContext.d.ts.map +1 -0
  420. package/dist/utils/internal/requestContext.js +47 -0
  421. package/dist/utils/internal/requestContext.js.map +1 -0
  422. package/dist/utils/metrics/index.d.ts +8 -0
  423. package/dist/utils/metrics/index.d.ts.map +1 -0
  424. package/dist/utils/metrics/index.js +8 -0
  425. package/dist/utils/metrics/index.js.map +1 -0
  426. package/dist/utils/metrics/tokenCounter.d.ts +36 -0
  427. package/dist/utils/metrics/tokenCounter.d.ts.map +1 -0
  428. package/dist/utils/metrics/tokenCounter.js +115 -0
  429. package/dist/utils/metrics/tokenCounter.js.map +1 -0
  430. package/dist/utils/network/fetchWithTimeout.d.ts +22 -0
  431. package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -0
  432. package/dist/utils/network/fetchWithTimeout.js +78 -0
  433. package/dist/utils/network/fetchWithTimeout.js.map +1 -0
  434. package/dist/utils/network/index.d.ts +7 -0
  435. package/dist/utils/network/index.d.ts.map +1 -0
  436. package/dist/utils/network/index.js +6 -0
  437. package/dist/utils/network/index.js.map +1 -0
  438. package/dist/utils/parsing/dateParser.d.ts +73 -0
  439. package/dist/utils/parsing/dateParser.d.ts.map +1 -0
  440. package/dist/utils/parsing/dateParser.js +108 -0
  441. package/dist/utils/parsing/dateParser.js.map +1 -0
  442. package/dist/utils/parsing/index.d.ts +9 -0
  443. package/dist/utils/parsing/index.d.ts.map +1 -0
  444. package/dist/utils/parsing/index.js +9 -0
  445. package/dist/utils/parsing/index.js.map +1 -0
  446. package/dist/utils/parsing/jsonParser.d.ts +83 -0
  447. package/dist/utils/parsing/jsonParser.d.ts.map +1 -0
  448. package/dist/utils/parsing/jsonParser.js +128 -0
  449. package/dist/utils/parsing/jsonParser.js.map +1 -0
  450. package/dist/utils/scheduling/index.d.ts +7 -0
  451. package/dist/utils/scheduling/index.d.ts.map +1 -0
  452. package/dist/utils/scheduling/index.js +7 -0
  453. package/dist/utils/scheduling/index.js.map +1 -0
  454. package/dist/utils/scheduling/scheduler.d.ts +73 -0
  455. package/dist/utils/scheduling/scheduler.d.ts.map +1 -0
  456. package/dist/utils/scheduling/scheduler.js +155 -0
  457. package/dist/utils/scheduling/scheduler.js.map +1 -0
  458. package/dist/utils/security/idGenerator.d.ts +144 -0
  459. package/dist/utils/security/idGenerator.d.ts.map +1 -0
  460. package/dist/utils/security/idGenerator.js +232 -0
  461. package/dist/utils/security/idGenerator.js.map +1 -0
  462. package/dist/utils/security/index.d.ts +10 -0
  463. package/dist/utils/security/index.d.ts.map +1 -0
  464. package/dist/utils/security/index.js +10 -0
  465. package/dist/utils/security/index.js.map +1 -0
  466. package/dist/utils/security/rateLimiter.d.ts +109 -0
  467. package/dist/utils/security/rateLimiter.d.ts.map +1 -0
  468. package/dist/utils/security/rateLimiter.js +202 -0
  469. package/dist/utils/security/rateLimiter.js.map +1 -0
  470. package/dist/utils/security/sanitization.d.ts +185 -0
  471. package/dist/utils/security/sanitization.d.ts.map +1 -0
  472. package/dist/utils/security/sanitization.js +472 -0
  473. package/dist/utils/security/sanitization.js.map +1 -0
  474. package/dist/utils/telemetry/instrumentation.d.ts +8 -0
  475. package/dist/utils/telemetry/instrumentation.d.ts.map +1 -0
  476. package/dist/utils/telemetry/instrumentation.js +121 -0
  477. package/dist/utils/telemetry/instrumentation.js.map +1 -0
  478. package/dist/utils/telemetry/semconv.d.ts +16 -0
  479. package/dist/utils/telemetry/semconv.d.ts.map +1 -0
  480. package/dist/utils/telemetry/semconv.js +16 -0
  481. package/dist/utils/telemetry/semconv.js.map +1 -0
  482. package/package.json +161 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logic.js","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/executeSql/logic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE;;;GAGG;AACH,MAAM,mBAAmB,GAAG;IAC1B,MAAM;IACN,QAAQ;IACR,UAAU;IACV,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,UAAU;CACF,CAAC;AAEX;;GAEG;AACH,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,gCAAgC,CAAC;SACxC,GAAG,CACF,cAAc,EACd,+BAA+B,cAAc,cAAc,CAC5D;SACA,QAAQ,CAAC,0DAA0D,CAAC;CACxE,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,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AAS,CAAC,CAAC,EAAE,GAAG,CAAC;SACxC,EACD,sBAAsB,CACvB,CAAC;QAEF,8CAA8C;QAC9C,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,MAAM,IAAI,QAAQ,CAChB,gBAAgB,CAAC,aAAa,EAC9B,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACjF;YACE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC;YACjC,aAAa;YACb,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAC/D,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @fileoverview Handles registration and error handling for the `execute_sql` tool.
3
+ * This module acts as the "handler" layer, connecting the pure business logic to the
4
+ * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
+ * @module src/mcp-server/tools/executeSql/registration
6
+ * @see {@link src/mcp-server/tools/executeSql/logic.ts} for the core business logic and schemas.
7
+ */
8
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ /**
10
+ * Configuration interface for the execute SQL tool
11
+ * This allows the tool to be enabled/disabled and configured via YAML
12
+ */
13
+ export interface ExecuteSqlToolConfig {
14
+ /** Whether the tool is enabled */
15
+ enabled: boolean;
16
+ /** Tool description override */
17
+ description?: string;
18
+ /** Security configuration */
19
+ security?: {
20
+ /** Whether to enforce read-only mode (default: true) */
21
+ readOnly?: boolean;
22
+ /** Maximum query length (default: 10000) */
23
+ maxQueryLength?: number;
24
+ /** Additional forbidden keywords */
25
+ forbiddenKeywords?: string[];
26
+ };
27
+ }
28
+ /**
29
+ * Set the configuration for the execute SQL tool
30
+ * This is called by the YAML configuration system
31
+ * @param config - Tool configuration
32
+ */
33
+ export declare function setExecuteSqlConfig(config: Partial<ExecuteSqlToolConfig>): void;
34
+ /**
35
+ * Get the current configuration for the execute SQL tool
36
+ * @returns Current tool configuration
37
+ */
38
+ export declare function getExecuteSqlConfig(): ExecuteSqlToolConfig;
39
+ /**
40
+ * Check if the execute SQL tool is enabled
41
+ * @returns True if the tool is enabled
42
+ */
43
+ export declare function isExecuteSqlEnabled(): boolean;
44
+ /**
45
+ * Registers the 'execute_sql' tool and its handler with the provided MCP server instance.
46
+ * This function uses ErrorHandler.tryCatch to ensure that any failure during the
47
+ * registration process itself is caught and logged, preventing server startup failures.
48
+ *
49
+ * @param server - The MCP server instance to register the tool with.
50
+ */
51
+ export declare const registerExecuteSqlTool: (server: McpServer) => Promise<void>;
52
+ //# sourceMappingURL=registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/executeSql/registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmCpE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE;QACT,wDAAwD;QACxD,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,4CAA4C;QAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,oCAAoC;QACpC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;CACH;AAmBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACpC,IAAI,CAoBN;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,oBAAoB,CAE1D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,KAChB,OAAO,CAAC,IAAI,CAmGd,CAAC"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @fileoverview Handles registration and error handling for the `execute_sql` tool.
3
+ * This module acts as the "handler" layer, connecting the pure business logic to the
4
+ * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
+ * @module src/mcp-server/tools/executeSql/registration
6
+ * @see {@link src/mcp-server/tools/executeSql/logic.ts} for the core business logic and schemas.
7
+ */
8
+ import { JsonRpcErrorCode } from "../../../types-global/errors.js";
9
+ import { ErrorHandler, requestContextService } from "../../../utils/index.js";
10
+ import { logOperationStart, logOperationSuccess, } from "../../../utils/internal/logging-helpers.js";
11
+ import { measureToolExecution } from "../../../utils/internal/performance.js";
12
+ import { getRequestContext } from "../../../utils/internal/asyncContext.js";
13
+ import { ExecuteSqlInputSchema, executeSqlLogic, ExecuteSqlResponseSchema, } from "./logic.js";
14
+ // The unique name for the tool, used for registration and identification.
15
+ const TOOL_NAME = "execute_sql";
16
+ // A concise description for the LLM. More detailed guidance should be in the
17
+ // parameter descriptions within the Zod schema in `logic.ts`.
18
+ const TOOL_DESCRIPTION = `Execute SQL statements against the IBM i database. Only SELECT and read-only operations are allowed for security.`;
19
+ const responseFormatter = (result) => ({
20
+ structuredContent: result,
21
+ content: [
22
+ {
23
+ type: "text",
24
+ text: `SQL Query executed successfully. Returned ${result.rowCount} rows.\n\n${JSON.stringify(result.data, null, 2)}`,
25
+ },
26
+ ],
27
+ });
28
+ /**
29
+ * Default configuration for the execute SQL tool
30
+ */
31
+ const DEFAULT_CONFIG = {
32
+ enabled: true,
33
+ security: {
34
+ readOnly: true,
35
+ maxQueryLength: 10000,
36
+ forbiddenKeywords: [],
37
+ },
38
+ };
39
+ /**
40
+ * Internal configuration storage
41
+ */
42
+ let toolConfig = DEFAULT_CONFIG;
43
+ /**
44
+ * Set the configuration for the execute SQL tool
45
+ * This is called by the YAML configuration system
46
+ * @param config - Tool configuration
47
+ */
48
+ export function setExecuteSqlConfig(config) {
49
+ toolConfig = {
50
+ ...DEFAULT_CONFIG,
51
+ ...config,
52
+ security: {
53
+ ...DEFAULT_CONFIG.security,
54
+ ...config.security,
55
+ },
56
+ };
57
+ const context = requestContextService.createRequestContext({
58
+ operation: "ConfigUpdate",
59
+ toolName: TOOL_NAME,
60
+ });
61
+ logOperationSuccess(context, "Execute SQL tool configuration updated", {
62
+ enabled: toolConfig.enabled,
63
+ readOnly: toolConfig.security?.readOnly,
64
+ maxQueryLength: toolConfig.security?.maxQueryLength,
65
+ });
66
+ }
67
+ /**
68
+ * Get the current configuration for the execute SQL tool
69
+ * @returns Current tool configuration
70
+ */
71
+ export function getExecuteSqlConfig() {
72
+ return toolConfig;
73
+ }
74
+ /**
75
+ * Check if the execute SQL tool is enabled
76
+ * @returns True if the tool is enabled
77
+ */
78
+ export function isExecuteSqlEnabled() {
79
+ return toolConfig.enabled;
80
+ }
81
+ /**
82
+ * Registers the 'execute_sql' tool and its handler with the provided MCP server instance.
83
+ * This function uses ErrorHandler.tryCatch to ensure that any failure during the
84
+ * registration process itself is caught and logged, preventing server startup failures.
85
+ *
86
+ * @param server - The MCP server instance to register the tool with.
87
+ */
88
+ export const registerExecuteSqlTool = async (server) => {
89
+ const registrationContext = requestContextService.createRequestContext({
90
+ operation: "RegisterTool",
91
+ toolName: TOOL_NAME,
92
+ });
93
+ logOperationStart(registrationContext, `Checking if tool should be registered: '${TOOL_NAME}'`, {
94
+ enabled: toolConfig.enabled,
95
+ });
96
+ // Only register if the tool is enabled
97
+ if (!toolConfig.enabled) {
98
+ logOperationSuccess(registrationContext, `Tool '${TOOL_NAME}' is disabled, skipping registration`);
99
+ return;
100
+ }
101
+ logOperationStart(registrationContext, `Registering tool: '${TOOL_NAME}'`);
102
+ await ErrorHandler.tryCatch(async () => {
103
+ const description = toolConfig.description || TOOL_DESCRIPTION;
104
+ server.registerTool(TOOL_NAME, {
105
+ title: "Execute SQL",
106
+ description,
107
+ inputSchema: ExecuteSqlInputSchema.shape,
108
+ outputSchema: ExecuteSqlResponseSchema.shape,
109
+ annotations: {
110
+ readOnlyHint: toolConfig.security?.readOnly, // Default to true for safety
111
+ destructiveHint: !(toolConfig.security?.readOnly ?? true), // Destructive if not read-only
112
+ openWorldHint: !(toolConfig.security?.readOnly ?? true), // Open world if not read-only
113
+ },
114
+ _meta: {
115
+ requiresAuth: true, // Requires database authentication
116
+ },
117
+ }, async (params, mcpContext) => {
118
+ try {
119
+ const result = await measureToolExecution(TOOL_NAME, () => executeSqlLogic(params), params);
120
+ return responseFormatter(result);
121
+ }
122
+ catch (error) {
123
+ const handlerContext = requestContextService.createRequestContext({
124
+ parentContext: mcpContext,
125
+ operation: `tool:${TOOL_NAME}`,
126
+ });
127
+ const handledError = ErrorHandler.handleError(error, {
128
+ operation: `tool:${TOOL_NAME}`,
129
+ context: getRequestContext() ?? handlerContext,
130
+ input: params,
131
+ });
132
+ return {
133
+ isError: true,
134
+ content: [
135
+ {
136
+ type: "text",
137
+ text: `SQL Error: ${handledError.message}`,
138
+ },
139
+ ],
140
+ structuredContent: {
141
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
+ code: handledError.code,
143
+ message: handledError.message,
144
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
145
+ details: handledError.details,
146
+ },
147
+ };
148
+ }
149
+ });
150
+ logOperationSuccess(registrationContext, `Tool '${TOOL_NAME}' registered successfully.`, {
151
+ enabled: toolConfig.enabled,
152
+ readOnly: toolConfig.security?.readOnly,
153
+ });
154
+ }, {
155
+ operation: `RegisteringTool_${TOOL_NAME}`,
156
+ context: registrationContext,
157
+ errorCode: JsonRpcErrorCode.InitializationFailed,
158
+ critical: true, // A failure to register a tool is a critical startup error.
159
+ });
160
+ };
161
+ //# sourceMappingURL=registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.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,EAAE;yBACtD;qBACF;oBACD,iBAAiB,EAAE;wBACjB,8DAA8D;wBAC9D,IAAI,EAAG,YAAoB,CAAC,IAAI;wBAChC,OAAO,EAAG,YAAsB,CAAC,OAAO;wBACxC,8DAA8D;wBAC9D,OAAO,EAAG,YAAoB,CAAC,OAAO;qBACvC;iBACF,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;QAEF,mBAAmB,CACjB,mBAAmB,EACnB,SAAS,SAAS,4BAA4B,EAC9C;YACE,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAAE,QAAQ;SACxC,CACF,CAAC;IACJ,CAAC,EACD;QACE,SAAS,EAAE,mBAAmB,SAAS,EAAE;QACzC,OAAO,EAAE,mBAAmB;QAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;QAChD,QAAQ,EAAE,IAAI,EAAE,4DAA4D;KAC7E,CACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @fileoverview Barrel file for the `generate_sql` tool.
3
+ * This file serves as the public interface for the generate SQL tool module,
4
+ * primarily exporting the `registerGenerateSqlTool` function. This function is
5
+ * responsible for registering the generate SQL tool with an MCP server instance,
6
+ * making it available for invocation by clients.
7
+ *
8
+ * Consuming modules should import from this barrel file to access
9
+ * the generate SQL tool's registration capabilities.
10
+ * @module src/mcp-server/tools/generateSql/index
11
+ */
12
+ export { registerGenerateSqlTool } from "./registration.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/generateSql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @fileoverview Barrel file for the `generate_sql` tool.
3
+ * This file serves as the public interface for the generate SQL tool module,
4
+ * primarily exporting the `registerGenerateSqlTool` function. This function is
5
+ * responsible for registering the generate SQL tool with an MCP server instance,
6
+ * making it available for invocation by clients.
7
+ *
8
+ * Consuming modules should import from this barrel file to access
9
+ * the generate SQL tool's registration capabilities.
10
+ * @module src/mcp-server/tools/generateSql/index
11
+ */
12
+ export { registerGenerateSqlTool } from "./registration.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/generateSql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @fileoverview Defines the core logic, schemas, and types for the `generate_sql` tool.
3
+ * This module is the single source of truth for the tool's data contracts (Zod schemas)
4
+ * and its pure business logic for generating SQL DDL statements from IBM i database objects.
5
+ * @module src/mcp-server/tools/generateSql/logic
6
+ * @see {@link src/mcp-server/tools/generateSql/registration.ts} for the handler and registration logic.
7
+ */
8
+ import { z } from "zod";
9
+ /**
10
+ * Zod schema defining the input parameters for the `generate_sql` tool.
11
+ */
12
+ export declare const GenerateSqlInputSchema: z.ZodObject<{
13
+ object_name: z.ZodString;
14
+ object_library: z.ZodDefault<z.ZodString>;
15
+ object_type: z.ZodDefault<z.ZodEnum<["ALIAS", "CONSTRAINT", "FUNCTION", "INDEX", "MASK", "PERMISSION", "PROCEDURE", "SCHEMA", "SEQUENCE", "TABLE", "TRIGGER", "TYPE", "VARIABLE", "VIEW", "XSR"]>>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ object_name: string;
18
+ object_library: string;
19
+ object_type: "ALIAS" | "CONSTRAINT" | "FUNCTION" | "INDEX" | "MASK" | "PERMISSION" | "PROCEDURE" | "SCHEMA" | "SEQUENCE" | "TABLE" | "TRIGGER" | "TYPE" | "VARIABLE" | "VIEW" | "XSR";
20
+ }, {
21
+ object_name: string;
22
+ object_library?: string | undefined;
23
+ object_type?: "ALIAS" | "CONSTRAINT" | "FUNCTION" | "INDEX" | "MASK" | "PERMISSION" | "PROCEDURE" | "SCHEMA" | "SEQUENCE" | "TABLE" | "TRIGGER" | "TYPE" | "VARIABLE" | "VIEW" | "XSR" | undefined;
24
+ }>;
25
+ /**
26
+ * Zod schema for the successful response of the `generate_sql` tool.
27
+ * Contains the generated DDL along with metadata about the source object.
28
+ */
29
+ export declare const GenerateSqlOutputSchema: z.ZodObject<{
30
+ sql: z.ZodString;
31
+ object_name: z.ZodString;
32
+ object_library: z.ZodString;
33
+ object_type: z.ZodString;
34
+ }, "strip", z.ZodTypeAny, {
35
+ object_name: string;
36
+ object_library: string;
37
+ object_type: string;
38
+ sql: string;
39
+ }, {
40
+ object_name: string;
41
+ object_library: string;
42
+ object_type: string;
43
+ sql: string;
44
+ }>;
45
+ /**
46
+ * TypeScript type inferred from the input schema.
47
+ * Represents the validated parameters passed to the generate SQL logic.
48
+ */
49
+ export type GenerateSqlInput = z.infer<typeof GenerateSqlInputSchema>;
50
+ /**
51
+ * TypeScript type inferred from the output schema.
52
+ * Represents the structured response returned by the generate SQL logic.
53
+ */
54
+ export type GenerateSqlOutput = z.infer<typeof GenerateSqlOutputSchema>;
55
+ /**
56
+ * Processes the core logic for the `generate_sql` tool.
57
+ * This function calls the QSYS2.GENERATE_SQL procedure to generate DDL for IBM i database objects.
58
+ *
59
+ * @param params - The validated input parameters containing object details
60
+ * @returns A promise resolving with the generated SQL DDL
61
+ * @throws {McpError} If the SQL generation encounters an unrecoverable issue
62
+ */
63
+ export declare function generateSqlLogic(params: GenerateSqlInput): Promise<GenerateSqlOutput>;
64
+ //# sourceMappingURL=logic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logic.d.ts","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/generateSql/logic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6BxB;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAsBe,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAkBc,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,iBAAiB,CAAC,CAuJ5B"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * @fileoverview Defines the core logic, schemas, and types for the `generate_sql` tool.
3
+ * This module is the single source of truth for the tool's data contracts (Zod schemas)
4
+ * and its pure business logic for generating SQL DDL statements from IBM i database objects.
5
+ * @module src/mcp-server/tools/generateSql/logic
6
+ * @see {@link src/mcp-server/tools/generateSql/registration.ts} for the handler and registration logic.
7
+ */
8
+ import { z } from "zod";
9
+ import { JsonRpcErrorCode, McpError } from "../../../types-global/errors.js";
10
+ import { getRequestContext } from "../../../utils/index.js";
11
+ import { logger } from "../../../utils/internal/logger.js";
12
+ import { IBMiConnectionPool } from "../../services/connectionPool.js";
13
+ /**
14
+ * Supported IBM i database object types for DDL generation.
15
+ * These correspond to the valid values for the DATABASE_OBJECT_TYPE parameter
16
+ * of the QSYS2.GENERATE_SQL stored procedure.
17
+ */
18
+ const OBJECT_TYPES = [
19
+ "ALIAS",
20
+ "CONSTRAINT",
21
+ "FUNCTION",
22
+ "INDEX",
23
+ "MASK",
24
+ "PERMISSION",
25
+ "PROCEDURE",
26
+ "SCHEMA",
27
+ "SEQUENCE",
28
+ "TABLE",
29
+ "TRIGGER",
30
+ "TYPE",
31
+ "VARIABLE",
32
+ "VIEW",
33
+ "XSR",
34
+ ];
35
+ /**
36
+ * Zod schema defining the input parameters for the `generate_sql` tool.
37
+ */
38
+ export const GenerateSqlInputSchema = z
39
+ .object({
40
+ object_name: z
41
+ .string()
42
+ .min(1, "Object name cannot be empty.")
43
+ .max(128, "Object name cannot exceed 128 characters.")
44
+ .describe("The name of the IBM i database object to generate DDL for."),
45
+ object_library: z
46
+ .string()
47
+ .min(1, "Library name cannot be empty.")
48
+ .max(128, "Library name cannot exceed 128 characters.")
49
+ .default("QSYS2")
50
+ .describe("The library where the database object is located. Defaults to QSYS2."),
51
+ object_type: z
52
+ .enum(OBJECT_TYPES)
53
+ .default("TABLE")
54
+ .describe("The type of database object to generate DDL for. Valid types include TABLE, VIEW, INDEX, PROCEDURE, FUNCTION, etc."),
55
+ })
56
+ .describe("Input schema for generating SQL DDL");
57
+ /**
58
+ * Zod schema for the successful response of the `generate_sql` tool.
59
+ * Contains the generated DDL along with metadata about the source object.
60
+ */
61
+ export const GenerateSqlOutputSchema = z
62
+ .object({
63
+ sql: z
64
+ .string()
65
+ .min(1, "Generated SQL cannot be empty.")
66
+ .describe("The generated DDL SQL statements for the specified database object."),
67
+ object_name: z
68
+ .string()
69
+ .describe("The name of the object the DDL was generated for."),
70
+ object_library: z
71
+ .string()
72
+ .describe("The library of the object the DDL was generated for."),
73
+ object_type: z
74
+ .string()
75
+ .describe("The type of the object the DDL was generated for."),
76
+ })
77
+ .describe("Output schema for generated SQL DDL");
78
+ /**
79
+ * Processes the core logic for the `generate_sql` tool.
80
+ * This function calls the QSYS2.GENERATE_SQL procedure to generate DDL for IBM i database objects.
81
+ *
82
+ * @param params - The validated input parameters containing object details
83
+ * @returns A promise resolving with the generated SQL DDL
84
+ * @throws {McpError} If the SQL generation encounters an unrecoverable issue
85
+ */
86
+ export async function generateSqlLogic(params) {
87
+ const context = getRequestContext();
88
+ logger.debug({ ...context, toolInput: params }, "Processing generate SQL DDL logic.");
89
+ const sql = `CALL QSYS2.GENERATE_SQL(
90
+ DATABASE_OBJECT_NAME => ?,
91
+ DATABASE_OBJECT_LIBRARY_NAME => ?,
92
+ DATABASE_OBJECT_TYPE => ?,
93
+ CREATE_OR_REPLACE_OPTION => '1',
94
+ PRIVILEGES_OPTION => '0',
95
+ STATEMENT_FORMATTING_OPTION => '0',
96
+ SOURCE_STREAM_FILE_END_OF_LINE => 'LF',
97
+ SOURCE_STREAM_FILE_CCSID => 1208
98
+ )`;
99
+ const startTime = Date.now();
100
+ try {
101
+ // Execute the GENERATE_SQL procedure using pagination to get all results
102
+ const result = await IBMiConnectionPool.executeQueryWithPagination(sql, [params.object_name, params.object_library, params.object_type], context, 500);
103
+ const executionTime = Date.now() - startTime;
104
+ if (!result.success) {
105
+ throw new McpError(JsonRpcErrorCode.DatabaseError, "SQL DDL generation failed", {
106
+ objectName: params.object_name,
107
+ objectLibrary: params.object_library,
108
+ objectType: params.object_type,
109
+ sqlReturnCode: result.sql_rc,
110
+ executionTime,
111
+ });
112
+ }
113
+ // Process the result data to extract the generated DDL
114
+ let generatedSql = "";
115
+ if (result.data && Array.isArray(result.data)) {
116
+ logger.debug({
117
+ ...context,
118
+ totalRows: result.data.length,
119
+ firstRowKeys: result.data[0] ? Object.keys(result.data[0]) : [],
120
+ }, "Processing GENERATE_SQL result data.");
121
+ // Build the result string from the SRCDTA column
122
+ // Results are already in correct order from the paginated query
123
+ const resultStrings = [];
124
+ for (const res of result.data) {
125
+ if (res && typeof res === "object" && "SRCDTA" in res) {
126
+ const srcData = res.SRCDTA;
127
+ if (srcData && typeof srcData === "string") {
128
+ resultStrings.push(srcData);
129
+ }
130
+ }
131
+ }
132
+ generatedSql = resultStrings.join("\n");
133
+ logger.debug({
134
+ ...context,
135
+ processedRows: resultStrings.length,
136
+ totalDdlLength: generatedSql.length,
137
+ avgRowLength: resultStrings.length > 0
138
+ ? Math.round(generatedSql.length / resultStrings.length)
139
+ : 0,
140
+ }, "DDL extraction completed.");
141
+ }
142
+ if (!generatedSql || generatedSql.trim().length === 0) {
143
+ throw new McpError(JsonRpcErrorCode.DatabaseError, "No SQL DDL generated for the specified object", {
144
+ objectName: params.object_name,
145
+ objectLibrary: params.object_library,
146
+ objectType: params.object_type,
147
+ resultRowCount: result.data?.length || 0,
148
+ });
149
+ }
150
+ const response = {
151
+ sql: generatedSql.trim(),
152
+ object_name: params.object_name,
153
+ object_library: params.object_library,
154
+ object_type: params.object_type,
155
+ };
156
+ logger.debug({
157
+ ...context,
158
+ objectName: params.object_name,
159
+ objectLibrary: params.object_library,
160
+ objectType: params.object_type,
161
+ sqlLength: response.sql.length,
162
+ executionTime,
163
+ rowCount: result.data?.length || 0,
164
+ }, "SQL DDL generated successfully.");
165
+ return response;
166
+ }
167
+ catch (error) {
168
+ const executionTime = Date.now() - startTime;
169
+ logger.error({
170
+ ...context,
171
+ error: error instanceof Error ? error.message : String(error),
172
+ objectName: params.object_name,
173
+ objectLibrary: params.object_library,
174
+ objectType: params.object_type,
175
+ executionTime,
176
+ }, "SQL DDL generation failed.");
177
+ // Re-throw McpErrors as-is, wrap other errors
178
+ if (error instanceof McpError) {
179
+ throw error;
180
+ }
181
+ throw new McpError(JsonRpcErrorCode.DatabaseError, `SQL DDL generation failed: ${error instanceof Error ? error.message : String(error)}`, {
182
+ objectName: params.object_name,
183
+ objectLibrary: params.object_library,
184
+ objectType: params.object_type,
185
+ executionTime,
186
+ originalError: error instanceof Error ? error.name : "Unknown",
187
+ });
188
+ }
189
+ }
190
+ //# sourceMappingURL=logic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logic.js","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/generateSql/logic.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MA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AAQ,CAChB,gBAAgB,CAAC,aAAa,EAC9B,8BAA8B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EACtF;YACE,UAAU,EAAE,MAAM,CAAC,WAAW;YAC9B,aAAa,EAAE,MAAM,CAAC,cAAc;YACpC,UAAU,EAAE,MAAM,CAAC,WAAW;YAC9B,aAAa;YACb,aAAa,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;SAC/D,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @fileoverview Handles registration and error handling for the `generate_sql` tool.
3
+ * This module acts as the "handler" layer, connecting the pure business logic to the
4
+ * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
+ * @module src/mcp-server/tools/generateSql/registration
6
+ * @see {@link src/mcp-server/tools/generateSql/logic.ts} for the core business logic and schemas.
7
+ */
8
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
9
+ export declare const TOOL_NAME = "describe_sql_object";
10
+ /**
11
+ * Registers the 'generate_sql' tool and its handler with the provided MCP server instance.
12
+ * This function uses ErrorHandler.tryCatch to ensure that any failure during the
13
+ * registration process itself is caught and logged, preventing server startup failures.
14
+ *
15
+ * @param server - The MCP server instance to register the tool with.
16
+ */
17
+ export declare const registerGenerateSqlTool: (server: McpServer) => Promise<void>;
18
+ //# sourceMappingURL=registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/generateSql/registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAoBpE,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAmB/C;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,SAAS,KAChB,OAAO,CAAC,IAAI,CA0Cd,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @fileoverview Handles registration and error handling for the `generate_sql` tool.
3
+ * This module acts as the "handler" layer, connecting the pure business logic to the
4
+ * MCP server and ensuring all outcomes (success or failure) are handled gracefully.
5
+ * @module src/mcp-server/tools/generateSql/registration
6
+ * @see {@link src/mcp-server/tools/generateSql/logic.ts} for the core business logic and schemas.
7
+ */
8
+ import { JsonRpcErrorCode } from "../../../types-global/errors.js";
9
+ import { ErrorHandler, requestContextService } from "../../../utils/index.js";
10
+ import { ToolsetManager } from "../../utils/config/toolsetManager.js";
11
+ import { logOperationStart, logOperationSuccess, } from "../../../utils/internal/logging-helpers.js";
12
+ import { createToolHandler, } from "../../../mcp-server/tools/utils/tool-utils.js";
13
+ import { GenerateSqlInputSchema, generateSqlLogic, GenerateSqlOutputSchema, } from "./logic.js";
14
+ // The unique name for the tool, used for registration and identification.
15
+ export const TOOL_NAME = "describe_sql_object";
16
+ // A concise description for the LLM. More detailed guidance should be in the
17
+ // parameter descriptions within the Zod schema in `logic.ts`.
18
+ const TOOL_DESCRIPTION = "Describes IBM i database objects by generating their SQL DDL statements. Useful for understanding object structure and recreating objects.";
19
+ const responseFormatter = (result) => ({
20
+ structuredContent: result,
21
+ content: [
22
+ {
23
+ type: "text",
24
+ text: `Successfully generated SQL DDL for ${result.object_type} '${result.object_name}' in library '${result.object_library}':\n\n${result.sql}`,
25
+ },
26
+ ],
27
+ });
28
+ /**
29
+ * Registers the 'generate_sql' tool and its handler with the provided MCP server instance.
30
+ * This function uses ErrorHandler.tryCatch to ensure that any failure during the
31
+ * registration process itself is caught and logged, preventing server startup failures.
32
+ *
33
+ * @param server - The MCP server instance to register the tool with.
34
+ */
35
+ export const registerGenerateSqlTool = async (server) => {
36
+ const registrationContext = requestContextService.createRequestContext({
37
+ operation: "RegisterTool",
38
+ toolName: TOOL_NAME,
39
+ });
40
+ logOperationStart(registrationContext, `Registering tool: '${TOOL_NAME}'`);
41
+ await ErrorHandler.tryCatch(async () => {
42
+ // Get toolset metadata for global tool
43
+ const toolsetManager = ToolsetManager.getInstance();
44
+ const toolsetMetadata = toolsetManager.generateToolMetadata(TOOL_NAME);
45
+ server.registerTool(TOOL_NAME, {
46
+ title: "Generate SQL DDL",
47
+ description: TOOL_DESCRIPTION,
48
+ inputSchema: GenerateSqlInputSchema.shape,
49
+ outputSchema: GenerateSqlOutputSchema.shape,
50
+ annotations: {
51
+ readOnlyHint: false, // This tool generates DDL which could be used for schema changes
52
+ openWorldHint: false, // This tool interacts with the IBM i database system
53
+ ...toolsetMetadata, // Add toolset metadata for filtering
54
+ },
55
+ }, createToolHandler(TOOL_NAME, generateSqlLogic, responseFormatter));
56
+ logOperationSuccess(registrationContext, `Tool '${TOOL_NAME}' registered successfully.`);
57
+ }, {
58
+ operation: `RegisteringTool_${TOOL_NAME}`,
59
+ context: registrationContext,
60
+ errorCode: JsonRpcErrorCode.InitializationFailed,
61
+ critical: true, // A failure to register a tool is a critical startup error.
62
+ });
63
+ };
64
+ //# sourceMappingURL=registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../../src/ibmi-mcp-server/tools/generateSql/registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,iBAAiB,GAElB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAEhB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,0EAA0E;AAC1E,MAAM,CAAC,MA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