@eclipse-glsp/server-mcp 2.7.0-next.9

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 (303) hide show
  1. package/LICENSE +642 -0
  2. package/README.md +57 -0
  3. package/lib/index.d.ts +23 -0
  4. package/lib/index.d.ts.map +1 -0
  5. package/lib/index.js +41 -0
  6. package/lib/index.js.map +1 -0
  7. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts +43 -0
  8. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.d.ts.map +1 -0
  9. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.js +96 -0
  10. package/lib/prompts/handlers/describe-diagram-mcp-prompt-handler.js.map +1 -0
  11. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts +43 -0
  12. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.d.ts.map +1 -0
  13. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.js +95 -0
  14. package/lib/prompts/handlers/suggest-improvements-mcp-prompt-handler.js.map +1 -0
  15. package/lib/prompts/index.d.ts +18 -0
  16. package/lib/prompts/index.d.ts.map +1 -0
  17. package/lib/prompts/index.js +34 -0
  18. package/lib/prompts/index.js.map +1 -0
  19. package/lib/resources/handlers/diagram-png-mcp-resource-handler.d.ts +81 -0
  20. package/lib/resources/handlers/diagram-png-mcp-resource-handler.d.ts.map +1 -0
  21. package/lib/resources/handlers/diagram-png-mcp-resource-handler.js +174 -0
  22. package/lib/resources/handlers/diagram-png-mcp-resource-handler.js.map +1 -0
  23. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.d.ts +52 -0
  24. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.d.ts.map +1 -0
  25. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.js +96 -0
  26. package/lib/resources/handlers/diagram-svg-mcp-resource-handler.js.map +1 -0
  27. package/lib/resources/index.d.ts +20 -0
  28. package/lib/resources/index.d.ts.map +1 -0
  29. package/lib/resources/index.js +36 -0
  30. package/lib/resources/index.js.map +1 -0
  31. package/lib/resources/services/element-types-provider.d.ts +65 -0
  32. package/lib/resources/services/element-types-provider.d.ts.map +1 -0
  33. package/lib/resources/services/element-types-provider.js +81 -0
  34. package/lib/resources/services/element-types-provider.js.map +1 -0
  35. package/lib/resources/services/mcp-model-serializer.d.ts +78 -0
  36. package/lib/resources/services/mcp-model-serializer.d.ts.map +1 -0
  37. package/lib/resources/services/mcp-model-serializer.js +188 -0
  38. package/lib/resources/services/mcp-model-serializer.js.map +1 -0
  39. package/lib/server/glsp-mcp-server.d.ts +82 -0
  40. package/lib/server/glsp-mcp-server.d.ts.map +1 -0
  41. package/lib/server/glsp-mcp-server.js +140 -0
  42. package/lib/server/glsp-mcp-server.js.map +1 -0
  43. package/lib/server/index.d.ts +37 -0
  44. package/lib/server/index.d.ts.map +1 -0
  45. package/lib/server/index.js +57 -0
  46. package/lib/server/index.js.map +1 -0
  47. package/lib/server/lru-event-store.d.ts +53 -0
  48. package/lib/server/lru-event-store.d.ts.map +1 -0
  49. package/lib/server/lru-event-store.js +100 -0
  50. package/lib/server/lru-event-store.js.map +1 -0
  51. package/lib/server/mcp-diagram-handler-dispatcher.d.ts +144 -0
  52. package/lib/server/mcp-diagram-handler-dispatcher.d.ts.map +1 -0
  53. package/lib/server/mcp-diagram-handler-dispatcher.js +382 -0
  54. package/lib/server/mcp-diagram-handler-dispatcher.js.map +1 -0
  55. package/lib/server/mcp-diagram-module.d.ts +123 -0
  56. package/lib/server/mcp-diagram-module.d.ts.map +1 -0
  57. package/lib/server/mcp-diagram-module.js +186 -0
  58. package/lib/server/mcp-diagram-module.js.map +1 -0
  59. package/lib/server/mcp-diagram-prompt-handler-registry.d.ts +33 -0
  60. package/lib/server/mcp-diagram-prompt-handler-registry.d.ts.map +1 -0
  61. package/lib/server/mcp-diagram-prompt-handler-registry.js +76 -0
  62. package/lib/server/mcp-diagram-prompt-handler-registry.js.map +1 -0
  63. package/lib/server/mcp-diagram-resource-handler-registry.d.ts +35 -0
  64. package/lib/server/mcp-diagram-resource-handler-registry.d.ts.map +1 -0
  65. package/lib/server/mcp-diagram-resource-handler-registry.js +94 -0
  66. package/lib/server/mcp-diagram-resource-handler-registry.js.map +1 -0
  67. package/lib/server/mcp-diagram-tool-handler-registry.d.ts +57 -0
  68. package/lib/server/mcp-diagram-tool-handler-registry.d.ts.map +1 -0
  69. package/lib/server/mcp-diagram-tool-handler-registry.js +111 -0
  70. package/lib/server/mcp-diagram-tool-handler-registry.js.map +1 -0
  71. package/lib/server/mcp-handler-shared.d.ts +142 -0
  72. package/lib/server/mcp-handler-shared.d.ts.map +1 -0
  73. package/lib/server/mcp-handler-shared.js +199 -0
  74. package/lib/server/mcp-handler-shared.js.map +1 -0
  75. package/lib/server/mcp-http-transport.d.ts +93 -0
  76. package/lib/server/mcp-http-transport.d.ts.map +1 -0
  77. package/lib/server/mcp-http-transport.js +350 -0
  78. package/lib/server/mcp-http-transport.js.map +1 -0
  79. package/lib/server/mcp-id-alias-service.d.ts +70 -0
  80. package/lib/server/mcp-id-alias-service.d.ts.map +1 -0
  81. package/lib/server/mcp-id-alias-service.js +85 -0
  82. package/lib/server/mcp-id-alias-service.js.map +1 -0
  83. package/lib/server/mcp-input-schemas.d.ts +73 -0
  84. package/lib/server/mcp-input-schemas.d.ts.map +1 -0
  85. package/lib/server/mcp-input-schemas.js +67 -0
  86. package/lib/server/mcp-input-schemas.js.map +1 -0
  87. package/lib/server/mcp-label-provider.d.ts +45 -0
  88. package/lib/server/mcp-label-provider.d.ts.map +1 -0
  89. package/lib/server/mcp-label-provider.js +42 -0
  90. package/lib/server/mcp-label-provider.js.map +1 -0
  91. package/lib/server/mcp-log-level-registry.d.ts +54 -0
  92. package/lib/server/mcp-log-level-registry.d.ts.map +1 -0
  93. package/lib/server/mcp-log-level-registry.js +80 -0
  94. package/lib/server/mcp-log-level-registry.js.map +1 -0
  95. package/lib/server/mcp-logger.d.ts +59 -0
  96. package/lib/server/mcp-logger.d.ts.map +1 -0
  97. package/lib/server/mcp-logger.js +104 -0
  98. package/lib/server/mcp-logger.js.map +1 -0
  99. package/lib/server/mcp-mime-types.d.ts +28 -0
  100. package/lib/server/mcp-mime-types.d.ts.map +1 -0
  101. package/lib/server/mcp-mime-types.js +18 -0
  102. package/lib/server/mcp-mime-types.js.map +1 -0
  103. package/lib/server/mcp-options.d.ts +39 -0
  104. package/lib/server/mcp-options.d.ts.map +1 -0
  105. package/lib/server/mcp-options.js +53 -0
  106. package/lib/server/mcp-options.js.map +1 -0
  107. package/lib/server/mcp-progress-reporter.d.ts +48 -0
  108. package/lib/server/mcp-progress-reporter.d.ts.map +1 -0
  109. package/lib/server/mcp-progress-reporter.js +66 -0
  110. package/lib/server/mcp-progress-reporter.js.map +1 -0
  111. package/lib/server/mcp-prompt-handler.d.ts +120 -0
  112. package/lib/server/mcp-prompt-handler.d.ts.map +1 -0
  113. package/lib/server/mcp-prompt-handler.js +131 -0
  114. package/lib/server/mcp-prompt-handler.js.map +1 -0
  115. package/lib/server/mcp-request-context.d.ts +37 -0
  116. package/lib/server/mcp-request-context.d.ts.map +1 -0
  117. package/lib/server/mcp-request-context.js +37 -0
  118. package/lib/server/mcp-request-context.js.map +1 -0
  119. package/lib/server/mcp-resource-handler.d.ts +212 -0
  120. package/lib/server/mcp-resource-handler.d.ts.map +1 -0
  121. package/lib/server/mcp-resource-handler.js +298 -0
  122. package/lib/server/mcp-resource-handler.js.map +1 -0
  123. package/lib/server/mcp-server-launcher.d.ts +143 -0
  124. package/lib/server/mcp-server-launcher.d.ts.map +1 -0
  125. package/lib/server/mcp-server-launcher.js +355 -0
  126. package/lib/server/mcp-server-launcher.js.map +1 -0
  127. package/lib/server/mcp-server-module.d.ts +143 -0
  128. package/lib/server/mcp-server-module.d.ts.map +1 -0
  129. package/lib/server/mcp-server-module.js +249 -0
  130. package/lib/server/mcp-server-module.js.map +1 -0
  131. package/lib/server/mcp-session.d.ts +44 -0
  132. package/lib/server/mcp-session.d.ts.map +1 -0
  133. package/lib/server/mcp-session.js +18 -0
  134. package/lib/server/mcp-session.js.map +1 -0
  135. package/lib/server/mcp-tool-handler.d.ts +259 -0
  136. package/lib/server/mcp-tool-handler.d.ts.map +1 -0
  137. package/lib/server/mcp-tool-handler.js +355 -0
  138. package/lib/server/mcp-tool-handler.js.map +1 -0
  139. package/lib/tools/handlers/count-elements-mcp-tool-handler.d.ts +46 -0
  140. package/lib/tools/handlers/count-elements-mcp-tool-handler.d.ts.map +1 -0
  141. package/lib/tools/handlers/count-elements-mcp-tool-handler.js +76 -0
  142. package/lib/tools/handlers/count-elements-mcp-tool-handler.js.map +1 -0
  143. package/lib/tools/handlers/create-edges-mcp-tool-handler.d.ts +112 -0
  144. package/lib/tools/handlers/create-edges-mcp-tool-handler.d.ts.map +1 -0
  145. package/lib/tools/handlers/create-edges-mcp-tool-handler.js +190 -0
  146. package/lib/tools/handlers/create-edges-mcp-tool-handler.js.map +1 -0
  147. package/lib/tools/handlers/create-nodes-mcp-tool-handler.d.ts +81 -0
  148. package/lib/tools/handlers/create-nodes-mcp-tool-handler.d.ts.map +1 -0
  149. package/lib/tools/handlers/create-nodes-mcp-tool-handler.js +123 -0
  150. package/lib/tools/handlers/create-nodes-mcp-tool-handler.js.map +1 -0
  151. package/lib/tools/handlers/delete-elements-mcp-tool-handler.d.ts +52 -0
  152. package/lib/tools/handlers/delete-elements-mcp-tool-handler.d.ts.map +1 -0
  153. package/lib/tools/handlers/delete-elements-mcp-tool-handler.js +73 -0
  154. package/lib/tools/handlers/delete-elements-mcp-tool-handler.js.map +1 -0
  155. package/lib/tools/handlers/diagram-model-mcp-tool-handler.d.ts +59 -0
  156. package/lib/tools/handlers/diagram-model-mcp-tool-handler.d.ts.map +1 -0
  157. package/lib/tools/handlers/diagram-model-mcp-tool-handler.js +78 -0
  158. package/lib/tools/handlers/diagram-model-mcp-tool-handler.js.map +1 -0
  159. package/lib/tools/handlers/element-types-mcp-tool-handler.d.ts +97 -0
  160. package/lib/tools/handlers/element-types-mcp-tool-handler.d.ts.map +1 -0
  161. package/lib/tools/handlers/element-types-mcp-tool-handler.js +155 -0
  162. package/lib/tools/handlers/element-types-mcp-tool-handler.js.map +1 -0
  163. package/lib/tools/handlers/get-selection-mcp-tool-handler.d.ts +43 -0
  164. package/lib/tools/handlers/get-selection-mcp-tool-handler.d.ts.map +1 -0
  165. package/lib/tools/handlers/get-selection-mcp-tool-handler.js +68 -0
  166. package/lib/tools/handlers/get-selection-mcp-tool-handler.js.map +1 -0
  167. package/lib/tools/handlers/layout-mcp-tool-handler.d.ts +43 -0
  168. package/lib/tools/handlers/layout-mcp-tool-handler.d.ts.map +1 -0
  169. package/lib/tools/handlers/layout-mcp-tool-handler.js +71 -0
  170. package/lib/tools/handlers/layout-mcp-tool-handler.js.map +1 -0
  171. package/lib/tools/handlers/modify-edges-mcp-tool-handler.d.ts +78 -0
  172. package/lib/tools/handlers/modify-edges-mcp-tool-handler.d.ts.map +1 -0
  173. package/lib/tools/handlers/modify-edges-mcp-tool-handler.js +136 -0
  174. package/lib/tools/handlers/modify-edges-mcp-tool-handler.js.map +1 -0
  175. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.d.ts +92 -0
  176. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.d.ts.map +1 -0
  177. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.js +125 -0
  178. package/lib/tools/handlers/modify-nodes-mcp-tool-handler.js.map +1 -0
  179. package/lib/tools/handlers/query-elements-mcp-tool-handler.d.ts +102 -0
  180. package/lib/tools/handlers/query-elements-mcp-tool-handler.d.ts.map +1 -0
  181. package/lib/tools/handlers/query-elements-mcp-tool-handler.js +158 -0
  182. package/lib/tools/handlers/query-elements-mcp-tool-handler.js.map +1 -0
  183. package/lib/tools/handlers/redo-mcp-tool-handler.d.ts +45 -0
  184. package/lib/tools/handlers/redo-mcp-tool-handler.d.ts.map +1 -0
  185. package/lib/tools/handlers/redo-mcp-tool-handler.js +73 -0
  186. package/lib/tools/handlers/redo-mcp-tool-handler.js.map +1 -0
  187. package/lib/tools/handlers/save-model-mcp-tool-handler.d.ts +55 -0
  188. package/lib/tools/handlers/save-model-mcp-tool-handler.d.ts.map +1 -0
  189. package/lib/tools/handlers/save-model-mcp-tool-handler.js +91 -0
  190. package/lib/tools/handlers/save-model-mcp-tool-handler.js.map +1 -0
  191. package/lib/tools/handlers/session-info-mcp-tool-handler.d.ts +65 -0
  192. package/lib/tools/handlers/session-info-mcp-tool-handler.d.ts.map +1 -0
  193. package/lib/tools/handlers/session-info-mcp-tool-handler.js +108 -0
  194. package/lib/tools/handlers/session-info-mcp-tool-handler.js.map +1 -0
  195. package/lib/tools/handlers/set-selection-mcp-tool-handler.d.ts +60 -0
  196. package/lib/tools/handlers/set-selection-mcp-tool-handler.d.ts.map +1 -0
  197. package/lib/tools/handlers/set-selection-mcp-tool-handler.js +103 -0
  198. package/lib/tools/handlers/set-selection-mcp-tool-handler.js.map +1 -0
  199. package/lib/tools/handlers/set-view-mcp-tool-handler.d.ts +110 -0
  200. package/lib/tools/handlers/set-view-mcp-tool-handler.d.ts.map +1 -0
  201. package/lib/tools/handlers/set-view-mcp-tool-handler.js +142 -0
  202. package/lib/tools/handlers/set-view-mcp-tool-handler.js.map +1 -0
  203. package/lib/tools/handlers/undo-mcp-tool-handler.d.ts +45 -0
  204. package/lib/tools/handlers/undo-mcp-tool-handler.d.ts.map +1 -0
  205. package/lib/tools/handlers/undo-mcp-tool-handler.js +74 -0
  206. package/lib/tools/handlers/undo-mcp-tool-handler.js.map +1 -0
  207. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.d.ts +66 -0
  208. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.d.ts.map +1 -0
  209. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.js +0 -0
  210. package/lib/tools/handlers/validate-diagram-mcp-tool-handler.js.map +1 -0
  211. package/lib/tools/index.d.ts +34 -0
  212. package/lib/tools/index.d.ts.map +1 -0
  213. package/lib/tools/index.js +50 -0
  214. package/lib/tools/index.js.map +1 -0
  215. package/lib/util/index.d.ts +18 -0
  216. package/lib/util/index.d.ts.map +1 -0
  217. package/lib/util/index.js +34 -0
  218. package/lib/util/index.js.map +1 -0
  219. package/lib/util/markdown-util.d.ts +20 -0
  220. package/lib/util/markdown-util.d.ts.map +1 -0
  221. package/lib/util/markdown-util.js +45 -0
  222. package/lib/util/markdown-util.js.map +1 -0
  223. package/lib/util/mcp-util.d.ts +22 -0
  224. package/lib/util/mcp-util.d.ts.map +1 -0
  225. package/lib/util/mcp-util.js +29 -0
  226. package/lib/util/mcp-util.js.map +1 -0
  227. package/package.json +63 -0
  228. package/src/index.ts +24 -0
  229. package/src/prompts/handlers/describe-diagram-mcp-prompt-handler.ts +89 -0
  230. package/src/prompts/handlers/suggest-improvements-mcp-prompt-handler.ts +86 -0
  231. package/src/prompts/index.ts +18 -0
  232. package/src/resources/handlers/diagram-png-mcp-resource-handler.ts +181 -0
  233. package/src/resources/handlers/diagram-svg-mcp-resource-handler.ts +89 -0
  234. package/src/resources/index.ts +20 -0
  235. package/src/resources/services/element-types-provider.ts +105 -0
  236. package/src/resources/services/mcp-model-serializer.ts +211 -0
  237. package/src/server/glsp-mcp-server.spec.ts +73 -0
  238. package/src/server/glsp-mcp-server.ts +196 -0
  239. package/src/server/index.ts +42 -0
  240. package/src/server/lru-event-store.spec.ts +121 -0
  241. package/src/server/lru-event-store.ts +112 -0
  242. package/src/server/mcp-diagram-handler-dispatcher.spec.ts +231 -0
  243. package/src/server/mcp-diagram-handler-dispatcher.ts +459 -0
  244. package/src/server/mcp-diagram-module.ts +248 -0
  245. package/src/server/mcp-diagram-prompt-handler-registry.ts +59 -0
  246. package/src/server/mcp-diagram-resource-handler-registry.ts +73 -0
  247. package/src/server/mcp-diagram-tool-handler-registry.ts +97 -0
  248. package/src/server/mcp-handler-shared.spec.ts +53 -0
  249. package/src/server/mcp-handler-shared.ts +247 -0
  250. package/src/server/mcp-http-transport-e2e.spec.ts +151 -0
  251. package/src/server/mcp-http-transport.spec.ts +385 -0
  252. package/src/server/mcp-http-transport.ts +368 -0
  253. package/src/server/mcp-id-alias-service.spec.ts +106 -0
  254. package/src/server/mcp-id-alias-service.ts +104 -0
  255. package/src/server/mcp-input-schemas.ts +82 -0
  256. package/src/server/mcp-label-provider.ts +52 -0
  257. package/src/server/mcp-log-level-registry.spec.ts +75 -0
  258. package/src/server/mcp-log-level-registry.ts +90 -0
  259. package/src/server/mcp-logger.spec.ts +227 -0
  260. package/src/server/mcp-logger.ts +91 -0
  261. package/src/server/mcp-mime-types.ts +31 -0
  262. package/src/server/mcp-options.ts +43 -0
  263. package/src/server/mcp-progress-reporter.spec.ts +93 -0
  264. package/src/server/mcp-progress-reporter.ts +67 -0
  265. package/src/server/mcp-prompt-handler.ts +157 -0
  266. package/src/server/mcp-request-context.ts +39 -0
  267. package/src/server/mcp-resource-handler.ts +389 -0
  268. package/src/server/mcp-server-launcher.spec.ts +173 -0
  269. package/src/server/mcp-server-launcher.ts +369 -0
  270. package/src/server/mcp-server-module.ts +287 -0
  271. package/src/server/mcp-session.ts +45 -0
  272. package/src/server/mcp-tool-handler.spec.ts +182 -0
  273. package/src/server/mcp-tool-handler.ts +431 -0
  274. package/src/server/raw-http.spec.ts +59 -0
  275. package/src/tools/handlers/count-elements-mcp-tool-handler.spec.ts +99 -0
  276. package/src/tools/handlers/count-elements-mcp-tool-handler.ts +66 -0
  277. package/src/tools/handlers/create-edges-mcp-tool-handler.spec.ts +196 -0
  278. package/src/tools/handlers/create-edges-mcp-tool-handler.ts +205 -0
  279. package/src/tools/handlers/create-nodes-mcp-tool-handler.spec.ts +197 -0
  280. package/src/tools/handlers/create-nodes-mcp-tool-handler.ts +131 -0
  281. package/src/tools/handlers/delete-elements-mcp-tool-handler.ts +73 -0
  282. package/src/tools/handlers/diagram-model-mcp-tool-handler.ts +66 -0
  283. package/src/tools/handlers/element-types-mcp-tool-handler.ts +151 -0
  284. package/src/tools/handlers/get-selection-mcp-tool-handler.ts +54 -0
  285. package/src/tools/handlers/layout-mcp-tool-handler.ts +56 -0
  286. package/src/tools/handlers/modify-edges-mcp-tool-handler.ts +148 -0
  287. package/src/tools/handlers/modify-nodes-mcp-tool-handler.ts +140 -0
  288. package/src/tools/handlers/query-elements-mcp-tool-handler.spec.ts +210 -0
  289. package/src/tools/handlers/query-elements-mcp-tool-handler.ts +161 -0
  290. package/src/tools/handlers/redo-mcp-tool-handler.ts +62 -0
  291. package/src/tools/handlers/save-model-mcp-tool-handler.ts +71 -0
  292. package/src/tools/handlers/session-info-mcp-tool-handler.spec.ts +152 -0
  293. package/src/tools/handlers/session-info-mcp-tool-handler.ts +97 -0
  294. package/src/tools/handlers/set-selection-mcp-tool-handler.spec.ts +118 -0
  295. package/src/tools/handlers/set-selection-mcp-tool-handler.ts +90 -0
  296. package/src/tools/handlers/set-view-mcp-tool-handler.ts +162 -0
  297. package/src/tools/handlers/undo-mcp-tool-handler.ts +61 -0
  298. package/src/tools/handlers/validate-diagram-mcp-tool-handler.ts +0 -0
  299. package/src/tools/index.ts +34 -0
  300. package/src/tools/tool-annotations.spec.ts +141 -0
  301. package/src/util/index.ts +18 -0
  302. package/src/util/markdown-util.ts +44 -0
  303. package/src/util/mcp-util.ts +25 -0
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @eclipse-glsp/server-mcp
2
+
3
+ > **Status: Experimental.** The MCP integration is under active development. Option names, schema shapes, and handler contracts MAY change in minor releases until the feature graduates from experimental status. Pin the package version in adopter projects; track release notes for breaking changes.
4
+
5
+ An extension of the [GLSP Node Server](https://github.com/eclipse-glsp/glsp-server-node) that exposes a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server alongside the existing GLSP server. This allows AI agents and LLM-based tools to interact with graphical diagram models using the standardized MCP interface.
6
+
7
+ ## What it provides
8
+
9
+ - **Tools** — Read/query and read/write operations to inspect, create, modify, delete, validate, and navigate diagram elements (and the active sessions themselves).
10
+ - **Resources** — URI-addressable read-only data; in the default ship-set this is `diagram-png` only (the rendered diagram screenshot, useful as embeddable image content). Other read endpoints ship as plain tools because in-the-wild MCP clients support tools more reliably than resources — see [Resource vs. Tool Mode](./ARCHITECTURE.md#resource-vs-tool-mode).
11
+ - **Prompts** — User-invokable templates (slash-command-style) that frame multi-step agent tasks against the diagram.
12
+
13
+ The MCP server is initialized as part of the GLSP server startup sequence and creates a new MCP session for each connecting MCP client. Each session runs a preconfigured AI agent persona (the _GLSP Modeling Agent_) that guides AI clients toward correct and safe usage of the modeling tools. It should be noted that the server startup sequence does not mean simply starting a server process, but rather that some kind of GLSP client starts the initialization.
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ yarn add @eclipse-glsp/server-mcp
19
+ # or
20
+ npm install @eclipse-glsp/server-mcp
21
+ ```
22
+
23
+ ## Integrating into a GLSP Server
24
+
25
+ Load the MCP container modules in your GLSP server's DI configuration:
26
+
27
+ ```typescript
28
+ import { GModelStorage, WebSocketServerLauncher, createAppModule } from '@eclipse-glsp/server/node';
29
+ import { Container } from 'inversify';
30
+ import { DefaultMcpDiagramModule, DefaultMcpServerModule } from '@eclipse-glsp/server-mcp';
31
+
32
+ const appContainer = new Container();
33
+ appContainer.load(createAppModule(options));
34
+
35
+ // Per-session bindings — must be part of `configureDiagramModule`.
36
+ const mcpDiagramModule = new DefaultMcpDiagramModule();
37
+ const serverModule = new MyServerModule().configureDiagramModule(new MyDiagramModule(() => GModelStorage), mcpDiagramModule);
38
+
39
+ const launcher = appContainer.resolve(WebSocketServerLauncher);
40
+ // Launcher-level bindings — must not be part of `configureDiagramModule`.
41
+ launcher.configure(serverModule, new DefaultMcpServerModule());
42
+ ```
43
+
44
+ The two modules are deliberately separate because they bind into different container scopes:
45
+
46
+ - `DefaultMcpDiagramModule` is mounted inside `configureDiagramModule`, so each `ClientSession.container` gets its own per-session services (`McpIdAliasService`, `McpModelSerializer`, the diagram-scope handler registries).
47
+ - `DefaultMcpServerModule` is mounted at the launcher container, so the MCP HTTP server, the option holder, and the server-scope tool/resource handlers live as launcher singletons.
48
+
49
+ The MCP server itself is started lazily on the first GLSP `InitializeAction` that carries an `mcpServer` configuration.
50
+
51
+ ## Further reading
52
+
53
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for the architecture, security model, configuration surface, deployment guidance, and the extension cookbook. The workflow example (`examples/workflow-server`) is the canonical reference for adopter wiring; each shipped handler carries an LLM-facing `description` field that doubles as developer-facing documentation.
54
+
55
+ ## License
56
+
57
+ EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
package/lib/index.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2025-2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ export * from './prompts';
17
+ export * from './resources';
18
+ export * from './server';
19
+ export * from './tools';
20
+ export * from './util';
21
+ export * from './server/mcp-diagram-module';
22
+ export * from './server/mcp-server-module';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AAGvB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /********************************************************************************
18
+ * Copyright (c) 2025-2026 EclipseSource and others.
19
+ *
20
+ * This program and the accompanying materials are made available under the
21
+ * terms of the Eclipse Public License v. 2.0 which is available at
22
+ * http://www.eclipse.org/legal/epl-2.0.
23
+ *
24
+ * This Source Code may also be made available under the following Secondary
25
+ * Licenses when the conditions for such availability set forth in the Eclipse
26
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
27
+ * with the GNU Classpath Exception which is available at
28
+ * https://www.gnu.org/software/classpath/license.html.
29
+ *
30
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
31
+ ********************************************************************************/
32
+ __exportStar(require("./prompts"), exports);
33
+ __exportStar(require("./resources"), exports);
34
+ __exportStar(require("./server"), exports);
35
+ __exportStar(require("./tools"), exports);
36
+ __exportStar(require("./util"), exports);
37
+ // Module classes — exported here (not from `./server`) to avoid circular imports through
38
+ // the handler barrels which the modules consume.
39
+ __exportStar(require("./server/mcp-diagram-module"), exports);
40
+ __exportStar(require("./server/mcp-server-module"), exports);
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,yCAAuB;AACvB,yFAAyF;AACzF,iDAAiD;AACjD,8DAA4C;AAC5C,6DAA2C"}
@@ -0,0 +1,43 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { ClientSessionManager } from '@eclipse-glsp/server';
17
+ import * as z from 'zod/v4';
18
+ import { AbstractMcpPromptHandler, McpPromptResult } from '../../server';
19
+ export declare const DescribeDiagramArgsSchema: z.ZodObject<{
20
+ sessionId: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ export type DescribeDiagramArgs = z.infer<typeof DescribeDiagramArgsSchema>;
23
+ /**
24
+ * Prompt template that instructs the agent to produce a structured description of a diagram.
25
+ * Pre-baked starting point invokable from the MCP-client UI; the agent then orchestrates the
26
+ * necessary tool calls on its own.
27
+ *
28
+ * Server-scope on purpose — the prompt itself has no per-session state, so we avoid forcing
29
+ * the user to type a sessionId in the common single-diagram case.
30
+ */
31
+ export declare class DescribeDiagramMcpPromptHandler extends AbstractMcpPromptHandler<DescribeDiagramArgs> {
32
+ static readonly NAME = "describe-diagram";
33
+ readonly name = "describe-diagram";
34
+ readonly title = "Describe Diagram";
35
+ readonly description: string;
36
+ readonly argsSchema: z.ZodObject<{
37
+ sessionId: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;
39
+ protected clientSessionManager: ClientSessionManager;
40
+ referencedToolNames(): string[];
41
+ protected createResult(args: DescribeDiagramArgs): McpPromptResult;
42
+ }
43
+ //# sourceMappingURL=describe-diagram-mcp-prompt-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe-diagram-mcp-prompt-handler.d.ts","sourceRoot":"","sources":["../../../src/prompts/handlers/describe-diagram-mcp-prompt-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAA0B,MAAM,cAAc,CAAC;AAUjG,eAAO,MAAM,yBAAyB;;iBAKpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;;;GAOG;AACH,qBACa,+BAAgC,SAAQ,wBAAwB,CAAC,mBAAmB,CAAC;IAC9F,MAAM,CAAC,QAAQ,CAAC,IAAI,sBAAsB;IAC1C,QAAQ,CAAC,IAAI,sBAAwC;IACrD,SAAkB,KAAK,sBAAsB;IAC7C,QAAQ,CAAC,WAAW,SAK+C;IACnE,QAAQ,CAAC,UAAU;;sBAA6B;IAElB,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAE1E,mBAAmB,IAAI,MAAM,EAAE;IAWxC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe;CAiBrE"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var DescribeDiagramMcpPromptHandler_1;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.DescribeDiagramMcpPromptHandler = exports.DescribeDiagramArgsSchema = void 0;
29
+ const server_1 = require("@eclipse-glsp/server");
30
+ const inversify_1 = require("inversify");
31
+ const z = require("zod/v4");
32
+ const server_2 = require("../../server");
33
+ const tools_1 = require("../../tools");
34
+ exports.DescribeDiagramArgsSchema = z.object({
35
+ sessionId: z
36
+ .string()
37
+ .optional()
38
+ .describe('GLSP client session id (open diagram). Defaults to the only open session; required when multiple are open.')
39
+ });
40
+ /**
41
+ * Prompt template that instructs the agent to produce a structured description of a diagram.
42
+ * Pre-baked starting point invokable from the MCP-client UI; the agent then orchestrates the
43
+ * necessary tool calls on its own.
44
+ *
45
+ * Server-scope on purpose — the prompt itself has no per-session state, so we avoid forcing
46
+ * the user to type a sessionId in the common single-diagram case.
47
+ */
48
+ let DescribeDiagramMcpPromptHandler = DescribeDiagramMcpPromptHandler_1 = class DescribeDiagramMcpPromptHandler extends server_2.AbstractMcpPromptHandler {
49
+ constructor() {
50
+ super(...arguments);
51
+ this.name = DescribeDiagramMcpPromptHandler_1.NAME;
52
+ this.title = 'Describe Diagram';
53
+ this.description = 'Produce a structured, skim-friendly description of an open diagram. ' +
54
+ 'The agent picks the right tools to gather data (overview, element-type breakdown, structure, notable elements) ' +
55
+ 'and writes the description in its own words. ' +
56
+ 'Use this as a starting point when the user asks "what does this diagram show?" or wants a documentation-style summary. ' +
57
+ '`sessionId` is optional — defaults to the only open session.';
58
+ this.argsSchema = exports.DescribeDiagramArgsSchema;
59
+ }
60
+ referencedToolNames() {
61
+ return [
62
+ tools_1.CountElementsMcpToolHandler.NAME,
63
+ tools_1.ElementTypesMcpToolHandler.NAME,
64
+ tools_1.DiagramModelMcpToolHandler.NAME,
65
+ tools_1.QueryElementsMcpToolHandler.NAME,
66
+ tools_1.SetSelectionMcpToolHandler.NAME,
67
+ tools_1.SetViewMcpToolHandler.NAME
68
+ ];
69
+ }
70
+ createResult(args) {
71
+ const sessionId = (0, server_2.resolveActiveSessionId)(this.clientSessionManager, args.sessionId);
72
+ const text = `Describe the diagram for session \`${sessionId}\`. Include:\n\n` +
73
+ `1. **Overview** — diagram type and total element count (use \`${tools_1.CountElementsMcpToolHandler.NAME}\`).\n` +
74
+ `2. **Element-type breakdown** — what kinds of elements are present and how many of each ` +
75
+ `(use \`${tools_1.ElementTypesMcpToolHandler.NAME}\` and \`${tools_1.CountElementsMcpToolHandler.NAME}\`).\n` +
76
+ `3. **Structure** — load the model with \`${tools_1.DiagramModelMcpToolHandler.NAME}\` and summarize the ` +
77
+ `hierarchy and major connections.\n` +
78
+ `4. **Notable elements** — call out anything that stands out (unconnected nodes, deeply ` +
79
+ `nested groups, missing labels). Use \`${tools_1.QueryElementsMcpToolHandler.NAME}\` to locate specific cases.\n\n` +
80
+ `Keep the description concise and skim-friendly. ` +
81
+ `When mentioning an element, prefer its label or type, with the alias appended in parens — e.g. ` +
82
+ `"the 'Brew' task (#7)" or "the decision node (#9)" — never the bare alias alone, since aliases mean nothing to the user. ` +
83
+ `Use \`${tools_1.SetSelectionMcpToolHandler.NAME}\` or \`${tools_1.SetViewMcpToolHandler.NAME} → 'center-on-elements'\` to draw the user's attention.`;
84
+ return { messages: [{ role: 'user', content: { type: 'text', text } }] };
85
+ }
86
+ };
87
+ exports.DescribeDiagramMcpPromptHandler = DescribeDiagramMcpPromptHandler;
88
+ DescribeDiagramMcpPromptHandler.NAME = 'describe-diagram';
89
+ __decorate([
90
+ (0, inversify_1.inject)(server_1.ClientSessionManager),
91
+ __metadata("design:type", Object)
92
+ ], DescribeDiagramMcpPromptHandler.prototype, "clientSessionManager", void 0);
93
+ exports.DescribeDiagramMcpPromptHandler = DescribeDiagramMcpPromptHandler = DescribeDiagramMcpPromptHandler_1 = __decorate([
94
+ (0, inversify_1.injectable)()
95
+ ], DescribeDiagramMcpPromptHandler);
96
+ //# sourceMappingURL=describe-diagram-mcp-prompt-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"describe-diagram-mcp-prompt-handler.js","sourceRoot":"","sources":["../../../src/prompts/handlers/describe-diagram-mcp-prompt-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;AAElF,iDAA4D;AAC5D,yCAA+C;AAC/C,4BAA4B;AAC5B,yCAAiG;AACjG,uCAOqB;AAER,QAAA,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4GAA4G,CAAC;CAC9H,CAAC,CAAC;AAGH;;;;;;;GAOG;AAEI,IAAM,+BAA+B,uCAArC,MAAM,+BAAgC,SAAQ,iCAA6C;IAA3F;;QAEM,SAAI,GAAG,iCAA+B,CAAC,IAAI,CAAC;QACnC,UAAK,GAAG,kBAAkB,CAAC;QACpC,gBAAW,GAChB,sEAAsE;YACtE,iHAAiH;YACjH,+CAA+C;YAC/C,yHAAyH;YACzH,8DAA8D,CAAC;QAC1D,eAAU,GAAG,iCAAyB,CAAC;IAgCpD,CAAC;IA5BY,mBAAmB;QACxB,OAAO;YACH,mCAA2B,CAAC,IAAI;YAChC,kCAA0B,CAAC,IAAI;YAC/B,kCAA0B,CAAC,IAAI;YAC/B,mCAA2B,CAAC,IAAI;YAChC,kCAA0B,CAAC,IAAI;YAC/B,6BAAqB,CAAC,IAAI;SAC7B,CAAC;IACN,CAAC;IAES,YAAY,CAAC,IAAyB;QAC5C,MAAM,SAAS,GAAG,IAAA,+BAAsB,EAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpF,MAAM,IAAI,GACN,sCAAsC,SAAS,kBAAkB;YACjE,iEAAiE,mCAA2B,CAAC,IAAI,QAAQ;YACzG,0FAA0F;YAC1F,UAAU,kCAA0B,CAAC,IAAI,YAAY,mCAA2B,CAAC,IAAI,QAAQ;YAC7F,4CAA4C,kCAA0B,CAAC,IAAI,uBAAuB;YAClG,oCAAoC;YACpC,yFAAyF;YACzF,yCAAyC,mCAA2B,CAAC,IAAI,kCAAkC;YAC3G,kDAAkD;YAClD,iGAAiG;YACjG,2HAA2H;YAC3H,SAAS,kCAA0B,CAAC,IAAI,WAAW,6BAAqB,CAAC,IAAI,yDAAyD,CAAC;QAC3I,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;IAC7E,CAAC;;AAzCQ,0EAA+B;AACxB,oCAAI,GAAG,kBAAkB,AAArB,CAAsB;AAWF;IAAvC,IAAA,kBAAM,EAAC,6BAAoB,CAAC;;6EAAsD;0CAZ1E,+BAA+B;IAD3C,IAAA,sBAAU,GAAE;GACA,+BAA+B,CA0C3C"}
@@ -0,0 +1,43 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { ClientSessionManager } from '@eclipse-glsp/server';
17
+ import * as z from 'zod/v4';
18
+ import { AbstractMcpPromptHandler, McpPromptResult } from '../../server';
19
+ export declare const SuggestImprovementsArgsSchema: z.ZodObject<{
20
+ sessionId: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ export type SuggestImprovementsArgs = z.infer<typeof SuggestImprovementsArgsSchema>;
23
+ /**
24
+ * Prompt template that asks the agent to review the diagram and propose concrete improvements
25
+ * (validation issues, structural smells, missing labels, etc.). The agent orchestrates the
26
+ * tool calls; this prompt only frames the task.
27
+ *
28
+ * Server-scope on purpose — the prompt itself has no per-session state, so we avoid forcing
29
+ * the user to type a sessionId in the common single-diagram case.
30
+ */
31
+ export declare class SuggestImprovementsMcpPromptHandler extends AbstractMcpPromptHandler<SuggestImprovementsArgs> {
32
+ static readonly NAME = "suggest-improvements";
33
+ readonly name = "suggest-improvements";
34
+ readonly title = "Suggest Diagram Improvements";
35
+ readonly description: string;
36
+ readonly argsSchema: z.ZodObject<{
37
+ sessionId: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strip>;
39
+ protected clientSessionManager: ClientSessionManager;
40
+ referencedToolNames(): string[];
41
+ protected createResult(args: SuggestImprovementsArgs): McpPromptResult;
42
+ }
43
+ //# sourceMappingURL=suggest-improvements-mcp-prompt-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggest-improvements-mcp-prompt-handler.d.ts","sourceRoot":"","sources":["../../../src/prompts/handlers/suggest-improvements-mcp-prompt-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAA0B,MAAM,cAAc,CAAC;AAQjG,eAAO,MAAM,6BAA6B;;iBAKxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF;;;;;;;GAOG;AACH,qBACa,mCAAoC,SAAQ,wBAAwB,CAAC,uBAAuB,CAAC;IACtG,MAAM,CAAC,QAAQ,CAAC,IAAI,0BAA0B;IAC9C,QAAQ,CAAC,IAAI,0BAA4C;IACzD,SAAkB,KAAK,kCAAkC;IACzD,QAAQ,CAAC,WAAW,SAK+C;IACnE,QAAQ,CAAC,UAAU;;sBAAiC;IAEtB,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAE1E,mBAAmB,IAAI,MAAM,EAAE;IASxC,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,uBAAuB,GAAG,eAAe;CAkBzE"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var SuggestImprovementsMcpPromptHandler_1;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.SuggestImprovementsMcpPromptHandler = exports.SuggestImprovementsArgsSchema = void 0;
29
+ const server_1 = require("@eclipse-glsp/server");
30
+ const inversify_1 = require("inversify");
31
+ const z = require("zod/v4");
32
+ const server_2 = require("../../server");
33
+ const tools_1 = require("../../tools");
34
+ exports.SuggestImprovementsArgsSchema = z.object({
35
+ sessionId: z
36
+ .string()
37
+ .optional()
38
+ .describe('GLSP client session id (open diagram). Defaults to the only open session; required when multiple are open.')
39
+ });
40
+ /**
41
+ * Prompt template that asks the agent to review the diagram and propose concrete improvements
42
+ * (validation issues, structural smells, missing labels, etc.). The agent orchestrates the
43
+ * tool calls; this prompt only frames the task.
44
+ *
45
+ * Server-scope on purpose — the prompt itself has no per-session state, so we avoid forcing
46
+ * the user to type a sessionId in the common single-diagram case.
47
+ */
48
+ let SuggestImprovementsMcpPromptHandler = SuggestImprovementsMcpPromptHandler_1 = class SuggestImprovementsMcpPromptHandler extends server_2.AbstractMcpPromptHandler {
49
+ constructor() {
50
+ super(...arguments);
51
+ this.name = SuggestImprovementsMcpPromptHandler_1.NAME;
52
+ this.title = 'Suggest Diagram Improvements';
53
+ this.description = 'Review an open diagram and propose concrete improvements grouped by severity ' +
54
+ '(must-fix vs. nice-to-have). The agent runs validation, checks connectivity, looks for unclear labels, ' +
55
+ 'and flags structural inconsistencies, then names the specific element ids for each suggestion so the user ' +
56
+ 'can act on them. Read-only by intent — the prompt instructs the agent not to modify the diagram, only propose. ' +
57
+ '`sessionId` is optional — defaults to the only open session.';
58
+ this.argsSchema = exports.SuggestImprovementsArgsSchema;
59
+ }
60
+ referencedToolNames() {
61
+ return [
62
+ tools_1.ValidateDiagramMcpToolHandler.NAME,
63
+ tools_1.DiagramModelMcpToolHandler.NAME,
64
+ tools_1.QueryElementsMcpToolHandler.NAME,
65
+ tools_1.SetSelectionMcpToolHandler.NAME
66
+ ];
67
+ }
68
+ createResult(args) {
69
+ const sessionId = (0, server_2.resolveActiveSessionId)(this.clientSessionManager, args.sessionId);
70
+ const text = `Review the diagram for session \`${sessionId}\` and propose concrete improvements. Focus on:\n\n` +
71
+ `1. **Validation issues** — run \`${tools_1.ValidateDiagramMcpToolHandler.NAME}\` and surface any markers.\n` +
72
+ `2. **Connectivity** — load the model (\`${tools_1.DiagramModelMcpToolHandler.NAME}\`) and flag unconnected ` +
73
+ `nodes or orphaned subgraphs.\n` +
74
+ `3. **Labelling** — use \`${tools_1.QueryElementsMcpToolHandler.NAME}\` to find nodes that lack a meaningful ` +
75
+ `label, and edges with missing or unclear text.\n` +
76
+ `4. **Structure** — call out elements whose type or placement looks inconsistent with ` +
77
+ `the rest of the diagram.\n\n` +
78
+ `Group findings by severity (must-fix vs. nice-to-have). ` +
79
+ `When naming elements, prefer their label or type with the alias in parens — e.g. ` +
80
+ `"the 'Brew' task (#7)" or "the decision node (#9)" — never the bare alias alone, since aliases mean nothing to the user. ` +
81
+ `Point at each suggestion via \`${tools_1.SetSelectionMcpToolHandler.NAME}\` so the user can navigate. ` +
82
+ `Do not modify the diagram — only propose.`;
83
+ return { messages: [{ role: 'user', content: { type: 'text', text } }] };
84
+ }
85
+ };
86
+ exports.SuggestImprovementsMcpPromptHandler = SuggestImprovementsMcpPromptHandler;
87
+ SuggestImprovementsMcpPromptHandler.NAME = 'suggest-improvements';
88
+ __decorate([
89
+ (0, inversify_1.inject)(server_1.ClientSessionManager),
90
+ __metadata("design:type", Object)
91
+ ], SuggestImprovementsMcpPromptHandler.prototype, "clientSessionManager", void 0);
92
+ exports.SuggestImprovementsMcpPromptHandler = SuggestImprovementsMcpPromptHandler = SuggestImprovementsMcpPromptHandler_1 = __decorate([
93
+ (0, inversify_1.injectable)()
94
+ ], SuggestImprovementsMcpPromptHandler);
95
+ //# sourceMappingURL=suggest-improvements-mcp-prompt-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggest-improvements-mcp-prompt-handler.js","sourceRoot":"","sources":["../../../src/prompts/handlers/suggest-improvements-mcp-prompt-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;AAElF,iDAA4D;AAC5D,yCAA+C;AAC/C,4BAA4B;AAC5B,yCAAiG;AACjG,uCAKqB;AAER,QAAA,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,SAAS,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4GAA4G,CAAC;CAC9H,CAAC,CAAC;AAGH;;;;;;;GAOG;AAEI,IAAM,mCAAmC,2CAAzC,MAAM,mCAAoC,SAAQ,iCAAiD;IAAnG;;QAEM,SAAI,GAAG,qCAAmC,CAAC,IAAI,CAAC;QACvC,UAAK,GAAG,8BAA8B,CAAC;QAChD,gBAAW,GAChB,+EAA+E;YAC/E,yGAAyG;YACzG,4GAA4G;YAC5G,iHAAiH;YACjH,8DAA8D,CAAC;QAC1D,eAAU,GAAG,qCAA6B,CAAC;IA+BxD,CAAC;IA3BY,mBAAmB;QACxB,OAAO;YACH,qCAA6B,CAAC,IAAI;YAClC,kCAA0B,CAAC,IAAI;YAC/B,mCAA2B,CAAC,IAAI;YAChC,kCAA0B,CAAC,IAAI;SAClC,CAAC;IACN,CAAC;IAES,YAAY,CAAC,IAA6B;QAChD,MAAM,SAAS,GAAG,IAAA,+BAAsB,EAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACpF,MAAM,IAAI,GACN,oCAAoC,SAAS,qDAAqD;YAClG,oCAAoC,qCAA6B,CAAC,IAAI,+BAA+B;YACrG,2CAA2C,kCAA0B,CAAC,IAAI,2BAA2B;YACrG,gCAAgC;YAChC,4BAA4B,mCAA2B,CAAC,IAAI,0CAA0C;YACtG,kDAAkD;YAClD,uFAAuF;YACvF,8BAA8B;YAC9B,0DAA0D;YAC1D,mFAAmF;YACnF,2HAA2H;YAC3H,kCAAkC,kCAA0B,CAAC,IAAI,+BAA+B;YAChG,2CAA2C,CAAC;QAChD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;IAC7E,CAAC;;AAxCQ,kFAAmC;AAC5B,wCAAI,GAAG,sBAAsB,AAAzB,CAA0B;AAWN;IAAvC,IAAA,kBAAM,EAAC,6BAAoB,CAAC;;iFAAsD;8CAZ1E,mCAAmC;IAD/C,IAAA,sBAAU,GAAE;GACA,mCAAmC,CAyC/C"}
@@ -0,0 +1,18 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ export * from './handlers/describe-diagram-mcp-prompt-handler';
17
+ export * from './handlers/suggest-improvements-mcp-prompt-handler';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,cAAc,gDAAgD,CAAC;AAC/D,cAAc,oDAAoD,CAAC"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ __exportStar(require("./handlers/describe-diagram-mcp-prompt-handler"), exports);
33
+ __exportStar(require("./handlers/suggest-improvements-mcp-prompt-handler"), exports);
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;;;AAElF,iFAA+D;AAC/D,qFAAmE"}
@@ -0,0 +1,81 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Role } from '@modelcontextprotocol/sdk/types.js';
17
+ import * as z from 'zod/v4';
18
+ import { AbstractMcpDiagramResourceHandler, McpMimeType, McpProgressReporter, McpResourceContent, McpResourceUri } from '../../server';
19
+ export declare const DiagramPngInputSchema: z.ZodObject<{
20
+ sessionId: z.ZodString;
21
+ scale: z.ZodOptional<z.ZodNumber>;
22
+ width: z.ZodOptional<z.ZodNumber>;
23
+ height: z.ZodOptional<z.ZodNumber>;
24
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
25
+ }, z.core.$strip>;
26
+ export type DiagramPngInput = z.infer<typeof DiagramPngInputSchema>;
27
+ /** Rendering lives on the client — `RequestExportAction('png')` routes to the registered PNG exporter, which returns base64 via `ExportResultAction`. */
28
+ export declare class DiagramPngMcpResourceHandler extends AbstractMcpDiagramResourceHandler<DiagramPngInput> {
29
+ /** Default timeout (in ms) used when the call doesn't override `timeoutMs`. Override via subclass + rebind. */
30
+ protected readonly defaultTimeoutMs: number;
31
+ /**
32
+ * Default `scale` multiplier when the caller doesn't pin `width`/`height`/`scale`. `1` means
33
+ * "render at the diagram's natural extent" — sharp because the client rasterises the SVG
34
+ * at the requested size. Adopters override (e.g. to `2` for a high-DPI deployment) via
35
+ * subclass + rebind.
36
+ */
37
+ protected readonly defaultScale: number;
38
+ static readonly NAME = "diagram-png";
39
+ readonly name = "diagram-png";
40
+ readonly title = "Diagram Model PNG";
41
+ readonly description: string;
42
+ readonly mimeType: McpMimeType;
43
+ readonly uri: McpResourceUri;
44
+ /** Both the user (visual artifact) and the assistant (visual reasoning) consume the rendered diagram. */
45
+ readonly audience: Role[];
46
+ /** Useful when relevant, but not always-relevant — clients may skip when text-only reasoning suffices. */
47
+ readonly priority = 0.6;
48
+ readonly toolAlternativeInputSchema: z.ZodObject<{
49
+ sessionId: z.ZodString;
50
+ scale: z.ZodOptional<z.ZodNumber>;
51
+ width: z.ZodOptional<z.ZodNumber>;
52
+ height: z.ZodOptional<z.ZodNumber>;
53
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
54
+ }, z.core.$strip>;
55
+ protected progress: McpProgressReporter;
56
+ protected clientActionKinds: Set<string>;
57
+ /** Skip-bind when the GLSP client doesn't speak `RequestExportAction` — every read would otherwise time out. */
58
+ canRegister(): boolean;
59
+ protected createResult({ scale, width, height, timeoutMs }: DiagramPngInput): Promise<McpResourceContent>;
60
+ /**
61
+ * Resolve the final render size with this precedence:
62
+ * - `width` and `height` both given → use as-is.
63
+ * - only one of `width`/`height` given → derive the other from the diagram aspect ratio.
64
+ * - neither dimension given → natural × (`scale` ?? {@link defaultScale}).
65
+ */
66
+ protected resolveSize(scale: number | undefined, width: number | undefined, height: number | undefined): {
67
+ width: number;
68
+ height: number;
69
+ };
70
+ /**
71
+ * Compute the diagram's natural extent as the bounding box of every {@link isGBoundsAware}
72
+ * element with both `position` and `size`. Throws when the model has no positioned elements
73
+ * — a 1×1 PNG of an empty diagram is technically renderable but useless, and surfacing it
74
+ * as a self-correctable error lets the LLM react (e.g. wait for layout, ask the user).
75
+ */
76
+ protected computeNaturalSize(): {
77
+ width: number;
78
+ height: number;
79
+ };
80
+ }
81
+ //# sourceMappingURL=diagram-png-mcp-resource-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-png-mcp-resource-handler.d.ts","sourceRoot":"","sources":["../../../src/resources/handlers/diagram-png-mcp-resource-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EACH,iCAAiC,EAEjC,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EAEjB,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,qBAAqB;;;;;;iBA+BhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,yJAAyJ;AACzJ,qBACa,4BAA6B,SAAQ,iCAAiC,CAAC,eAAe,CAAC;IAChG,+GAA+G;IAC/G,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAQ;IAEnD;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAK;IAE5C,MAAM,CAAC,QAAQ,CAAC,IAAI,iBAAiB;IACrC,QAAQ,CAAC,IAAI,iBAAqC;IAClD,SAAkB,KAAK,uBAAuB;IAC9C,QAAQ,CAAC,WAAW,SAO4F;IAChH,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAe;IAC7C,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAmD;IAC/E,yGAAyG;IACzG,SAAkB,QAAQ,EAAE,IAAI,EAAE,CAAyB;IAC3D,0GAA0G;IAC1G,SAAkB,QAAQ,OAAO;IAIjC,SAAkB,0BAA0B;;;;;;sBAAyB;IAExC,SAAS,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IAE1C,SAAS,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAEpE,gHAAgH;IACvG,WAAW,IAAI,OAAO;cAIf,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAe/G;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CACjB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,MAAM,GAAG,SAAS,GAC3B;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAkBpC;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAsBpE"}