@angular-modernizer/adapter-mcp 0.3.0 → 1.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 (298) hide show
  1. package/README.md +181 -282
  2. package/dist/cli.js +21 -13
  3. package/dist/core/project-analyzer.d.ts +3 -12
  4. package/dist/core/project-analyzer.js +3 -12
  5. package/dist/index.d.ts +122 -6
  6. package/dist/index.js +49 -5
  7. package/dist/mcp-watcher.d.ts +32 -7
  8. package/dist/mcp-watcher.js +16 -15
  9. package/dist/scan-host/scan-host.d.ts +119 -0
  10. package/dist/scan-host/scan-host.js +376 -0
  11. package/dist/scan-host/scan-protocol.d.ts +35 -0
  12. package/dist/scan-host/scan-protocol.js +6 -0
  13. package/dist/scan-host/scan-worker.d.ts +14 -0
  14. package/dist/scan-host/scan-worker.js +48 -0
  15. package/dist/server/limited-stdio-transport.d.ts +75 -0
  16. package/dist/server/limited-stdio-transport.js +115 -0
  17. package/dist/server/mcp-server.d.ts +20 -18
  18. package/dist/server/mcp-server.js +42 -79
  19. package/dist/server/package-version.d.ts +16 -0
  20. package/dist/server/package-version.js +37 -0
  21. package/dist/server/sdk-server.d.ts +71 -0
  22. package/dist/server/sdk-server.js +113 -0
  23. package/dist/server/tool-registry.d.ts +6 -9
  24. package/dist/server/tool-registry.js +6 -12
  25. package/dist/streaming/progress-store.d.ts +22 -5
  26. package/dist/streaming/progress-store.js +9 -5
  27. package/dist/tools/analyze-build-impact.d.ts +276 -35
  28. package/dist/tools/analyze-build-impact.js +175 -28
  29. package/dist/tools/analyze-core-to-shared.d.ts +176 -16
  30. package/dist/tools/analyze-core-to-shared.js +124 -19
  31. package/dist/tools/analyze-parser-performance.d.ts +209 -15
  32. package/dist/tools/analyze-parser-performance.js +119 -56
  33. package/dist/tools/analyze-project.d.ts +349 -17
  34. package/dist/tools/analyze-project.js +282 -97
  35. package/dist/tools/check-incremental-compatibility.d.ts +74 -12
  36. package/dist/tools/check-incremental-compatibility.js +69 -10
  37. package/dist/tools/collect-feedback.d.ts +225 -21
  38. package/dist/tools/collect-feedback.js +199 -118
  39. package/dist/tools/compare-health.d.ts +413 -0
  40. package/dist/tools/compare-health.js +479 -0
  41. package/dist/tools/extract-libraries.d.ts +200 -24
  42. package/dist/tools/extract-libraries.js +131 -27
  43. package/dist/tools/find-angular-symbol.d.ts +92 -24
  44. package/dist/tools/find-angular-symbol.js +70 -20
  45. package/dist/tools/find-component-hosts.d.ts +603 -27
  46. package/dist/tools/find-component-hosts.js +223 -19
  47. package/dist/tools/find-usages.d.ts +102 -22
  48. package/dist/tools/find-usages.js +81 -21
  49. package/dist/tools/get-bootstrap-execution.d.ts +183 -25
  50. package/dist/tools/get-bootstrap-execution.js +109 -25
  51. package/dist/tools/get-call-graph.d.ts +127 -12
  52. package/dist/tools/get-call-graph.js +84 -19
  53. package/dist/tools/get-operation-progress-tool.d.ts +126 -8
  54. package/dist/tools/get-operation-progress-tool.js +124 -12
  55. package/dist/tools/get-operation-progress.d.ts +27 -1
  56. package/dist/tools/get-operation-progress.js +5 -5
  57. package/dist/tools/helpers/analysis-output.d.ts +182 -0
  58. package/dist/tools/helpers/analysis-output.js +165 -0
  59. package/dist/tools/helpers/batch-kernel.d.ts +14 -0
  60. package/dist/tools/helpers/batch-kernel.js +12 -0
  61. package/dist/tools/helpers/build-schemas.d.ts +36 -0
  62. package/dist/tools/helpers/build-schemas.js +23 -0
  63. package/dist/tools/helpers/citation-file-source.d.ts +10 -0
  64. package/dist/tools/helpers/citation-file-source.js +82 -0
  65. package/dist/tools/helpers/compact-output.d.ts +2 -1
  66. package/dist/tools/helpers/compact-output.js +2 -1
  67. package/dist/tools/helpers/finding-window.d.ts +43 -0
  68. package/dist/tools/helpers/finding-window.js +64 -0
  69. package/dist/tools/helpers/health-delta.d.ts +99 -0
  70. package/dist/tools/helpers/health-delta.js +236 -0
  71. package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
  72. package/dist/tools/helpers/investigation-schemas.js +48 -0
  73. package/dist/tools/helpers/library-imports.d.ts +57 -0
  74. package/dist/tools/helpers/library-imports.js +151 -0
  75. package/dist/tools/helpers/load-source-files.d.ts +30 -0
  76. package/dist/tools/helpers/load-source-files.js +34 -0
  77. package/dist/tools/helpers/output-contract.d.ts +32 -0
  78. package/dist/tools/helpers/output-contract.js +32 -0
  79. package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
  80. package/dist/tools/helpers/platform-root-resolver.js +75 -48
  81. package/dist/tools/helpers/process-output.d.ts +19 -0
  82. package/dist/tools/helpers/process-output.js +31 -0
  83. package/dist/tools/helpers/project-cache.d.ts +60 -37
  84. package/dist/tools/helpers/project-cache.js +54 -37
  85. package/dist/tools/helpers/project-decorators.d.ts +14 -0
  86. package/dist/tools/helpers/project-decorators.js +22 -0
  87. package/dist/tools/helpers/rule-matcher.js +5 -0
  88. package/dist/tools/helpers/rule-runner.d.ts +25 -13
  89. package/dist/tools/helpers/rule-runner.js +45 -24
  90. package/dist/tools/helpers/scan-cache.d.ts +22 -0
  91. package/dist/tools/helpers/scan-cache.js +34 -0
  92. package/dist/tools/helpers/scan-engine.d.ts +107 -0
  93. package/dist/tools/helpers/scan-engine.js +197 -0
  94. package/dist/tools/helpers/scan-plan.d.ts +5 -2
  95. package/dist/tools/helpers/scan-plan.js +18 -3
  96. package/dist/tools/helpers/scope-paths.d.ts +17 -0
  97. package/dist/tools/helpers/scope-paths.js +32 -0
  98. package/dist/tools/helpers/suggestion-generator.d.ts +9 -13
  99. package/dist/tools/helpers/suggestion-generator.js +0 -12
  100. package/dist/tools/helpers/tool-cache.d.ts +11 -0
  101. package/dist/tools/helpers/tool-cache.js +15 -0
  102. package/dist/tools/helpers/tool-context.d.ts +63 -0
  103. package/dist/tools/helpers/tool-context.js +79 -0
  104. package/dist/tools/helpers/transform-safety.d.ts +40 -0
  105. package/dist/tools/helpers/transform-safety.js +87 -0
  106. package/dist/tools/helpers/validation-output.d.ts +53 -0
  107. package/dist/tools/helpers/validation-output.js +48 -0
  108. package/dist/tools/inspect-form-group.d.ts +262 -24
  109. package/dist/tools/inspect-form-group.js +134 -13
  110. package/dist/tools/inspect-i18n.d.ts +410 -23
  111. package/dist/tools/inspect-i18n.js +213 -13
  112. package/dist/tools/inspect-template.d.ts +260 -22
  113. package/dist/tools/inspect-template.js +174 -13
  114. package/dist/tools/learn-patterns.d.ts +210 -13
  115. package/dist/tools/learn-patterns.js +113 -12
  116. package/dist/tools/list-imports.d.ts +152 -34
  117. package/dist/tools/list-imports.js +124 -18
  118. package/dist/tools/orchestrate-migration.d.ts +159 -14
  119. package/dist/tools/orchestrate-migration.js +147 -20
  120. package/dist/tools/parse-stack-trace.d.ts +78 -21
  121. package/dist/tools/parse-stack-trace.js +44 -7
  122. package/dist/tools/plan-migration.d.ts +395 -26
  123. package/dist/tools/plan-migration.js +173 -22
  124. package/dist/tools/resolve-type.d.ts +57 -9
  125. package/dist/tools/resolve-type.js +49 -12
  126. package/dist/tools/review-feedback.d.ts +214 -16
  127. package/dist/tools/review-feedback.js +142 -57
  128. package/dist/tools/rollback-changes.d.ts +88 -7
  129. package/dist/tools/rollback-changes.js +74 -19
  130. package/dist/tools/run-angular-cli.d.ts +57 -12
  131. package/dist/tools/run-angular-cli.js +76 -13
  132. package/dist/tools/run-build.d.ts +127 -13
  133. package/dist/tools/run-build.js +128 -16
  134. package/dist/tools/run-schematic.d.ts +82 -12
  135. package/dist/tools/run-schematic.js +115 -18
  136. package/dist/tools/scan-all.d.ts +88 -23
  137. package/dist/tools/scan-all.js +161 -220
  138. package/dist/tools/scan-angular.d.ts +60 -19
  139. package/dist/tools/scan-angular.js +100 -141
  140. package/dist/tools/scan-architecture.d.ts +92 -24
  141. package/dist/tools/scan-architecture.js +268 -211
  142. package/dist/tools/scan-solid.d.ts +59 -19
  143. package/dist/tools/scan-solid.js +98 -139
  144. package/dist/tools/search-codebase.d.ts +110 -23
  145. package/dist/tools/search-codebase.js +67 -11
  146. package/dist/tools/server-status.d.ts +392 -26
  147. package/dist/tools/server-status.js +260 -27
  148. package/dist/tools/suggest-improvements.d.ts +105 -10
  149. package/dist/tools/suggest-improvements.js +91 -51
  150. package/dist/tools/trace-output-flow.d.ts +713 -26
  151. package/dist/tools/trace-output-flow.js +396 -33
  152. package/dist/tools/transform-code-batch.d.ts +3 -0
  153. package/dist/tools/transform-code-batch.js +10 -5
  154. package/dist/tools/transform-code.d.ts +402 -18
  155. package/dist/tools/transform-code.js +708 -649
  156. package/dist/tools/validate-before-transform.d.ts +136 -7
  157. package/dist/tools/validate-before-transform.js +65 -9
  158. package/dist/tools/validate-project-compatibility.d.ts +82 -15
  159. package/dist/tools/validate-project-compatibility.js +84 -15
  160. package/dist/tools/validate-transformation.d.ts +243 -8
  161. package/dist/tools/validate-transformation.js +127 -23
  162. package/dist/tools/verify-citations.d.ts +202 -0
  163. package/dist/tools/verify-citations.js +221 -0
  164. package/dist/types.d.ts +78 -11
  165. package/dist/types.js +0 -5
  166. package/dist/utils/format-tool-response.d.ts +22 -59
  167. package/dist/utils/format-tool-response.js +25 -134
  168. package/package.json +31 -20
  169. package/dist/cli.d.ts.map +0 -1
  170. package/dist/cli.js.map +0 -1
  171. package/dist/core/project-analyzer.d.ts.map +0 -1
  172. package/dist/core/project-analyzer.js.map +0 -1
  173. package/dist/index.d.ts.map +0 -1
  174. package/dist/index.js.map +0 -1
  175. package/dist/mcp-watcher.d.ts.map +0 -1
  176. package/dist/mcp-watcher.js.map +0 -1
  177. package/dist/server/json-rpc-handler.d.ts +0 -98
  178. package/dist/server/json-rpc-handler.d.ts.map +0 -1
  179. package/dist/server/json-rpc-handler.js +0 -301
  180. package/dist/server/json-rpc-handler.js.map +0 -1
  181. package/dist/server/mcp-server.d.ts.map +0 -1
  182. package/dist/server/mcp-server.js.map +0 -1
  183. package/dist/server/stdio-guard.d.ts.map +0 -1
  184. package/dist/server/stdio-guard.js.map +0 -1
  185. package/dist/server/tool-registry.d.ts.map +0 -1
  186. package/dist/server/tool-registry.js.map +0 -1
  187. package/dist/streaming/progress-store.d.ts.map +0 -1
  188. package/dist/streaming/progress-store.js.map +0 -1
  189. package/dist/tools/analyze-build-impact.d.ts.map +0 -1
  190. package/dist/tools/analyze-build-impact.js.map +0 -1
  191. package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
  192. package/dist/tools/analyze-core-to-shared.js.map +0 -1
  193. package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
  194. package/dist/tools/analyze-parser-performance.js.map +0 -1
  195. package/dist/tools/analyze-project.d.ts.map +0 -1
  196. package/dist/tools/analyze-project.js.map +0 -1
  197. package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
  198. package/dist/tools/check-incremental-compatibility.js.map +0 -1
  199. package/dist/tools/collect-feedback.d.ts.map +0 -1
  200. package/dist/tools/collect-feedback.js.map +0 -1
  201. package/dist/tools/extract-libraries.d.ts.map +0 -1
  202. package/dist/tools/extract-libraries.js.map +0 -1
  203. package/dist/tools/find-angular-symbol.d.ts.map +0 -1
  204. package/dist/tools/find-angular-symbol.js.map +0 -1
  205. package/dist/tools/find-component-hosts.d.ts.map +0 -1
  206. package/dist/tools/find-component-hosts.js.map +0 -1
  207. package/dist/tools/find-usages.d.ts.map +0 -1
  208. package/dist/tools/find-usages.js.map +0 -1
  209. package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
  210. package/dist/tools/get-bootstrap-execution.js.map +0 -1
  211. package/dist/tools/get-call-graph.d.ts.map +0 -1
  212. package/dist/tools/get-call-graph.js.map +0 -1
  213. package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
  214. package/dist/tools/get-operation-progress-tool.js.map +0 -1
  215. package/dist/tools/get-operation-progress.d.ts.map +0 -1
  216. package/dist/tools/get-operation-progress.js.map +0 -1
  217. package/dist/tools/helpers/compact-output.d.ts.map +0 -1
  218. package/dist/tools/helpers/compact-output.js.map +0 -1
  219. package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
  220. package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
  221. package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
  222. package/dist/tools/helpers/find-ts-config.js.map +0 -1
  223. package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
  224. package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
  225. package/dist/tools/helpers/project-cache.d.ts.map +0 -1
  226. package/dist/tools/helpers/project-cache.js.map +0 -1
  227. package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
  228. package/dist/tools/helpers/rule-matcher.js.map +0 -1
  229. package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
  230. package/dist/tools/helpers/rule-runner.js.map +0 -1
  231. package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
  232. package/dist/tools/helpers/scan-plan.js.map +0 -1
  233. package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
  234. package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
  235. package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
  236. package/dist/tools/helpers/suggestion-generator.js.map +0 -1
  237. package/dist/tools/inspect-form-group.d.ts.map +0 -1
  238. package/dist/tools/inspect-form-group.js.map +0 -1
  239. package/dist/tools/inspect-i18n.d.ts.map +0 -1
  240. package/dist/tools/inspect-i18n.js.map +0 -1
  241. package/dist/tools/inspect-template.d.ts.map +0 -1
  242. package/dist/tools/inspect-template.js.map +0 -1
  243. package/dist/tools/learn-patterns.d.ts.map +0 -1
  244. package/dist/tools/learn-patterns.js.map +0 -1
  245. package/dist/tools/list-imports.d.ts.map +0 -1
  246. package/dist/tools/list-imports.js.map +0 -1
  247. package/dist/tools/orchestrate-migration.d.ts.map +0 -1
  248. package/dist/tools/orchestrate-migration.js.map +0 -1
  249. package/dist/tools/parse-stack-trace.d.ts.map +0 -1
  250. package/dist/tools/parse-stack-trace.js.map +0 -1
  251. package/dist/tools/plan-migration.d.ts.map +0 -1
  252. package/dist/tools/plan-migration.js.map +0 -1
  253. package/dist/tools/resolve-type.d.ts.map +0 -1
  254. package/dist/tools/resolve-type.js.map +0 -1
  255. package/dist/tools/review-feedback.d.ts.map +0 -1
  256. package/dist/tools/review-feedback.js.map +0 -1
  257. package/dist/tools/rollback-changes.d.ts.map +0 -1
  258. package/dist/tools/rollback-changes.js.map +0 -1
  259. package/dist/tools/run-angular-cli.d.ts.map +0 -1
  260. package/dist/tools/run-angular-cli.js.map +0 -1
  261. package/dist/tools/run-build.d.ts.map +0 -1
  262. package/dist/tools/run-build.js.map +0 -1
  263. package/dist/tools/run-schematic.d.ts.map +0 -1
  264. package/dist/tools/run-schematic.js.map +0 -1
  265. package/dist/tools/scan-all.d.ts.map +0 -1
  266. package/dist/tools/scan-all.js.map +0 -1
  267. package/dist/tools/scan-angular.d.ts.map +0 -1
  268. package/dist/tools/scan-angular.js.map +0 -1
  269. package/dist/tools/scan-architecture.d.ts.map +0 -1
  270. package/dist/tools/scan-architecture.js.map +0 -1
  271. package/dist/tools/scan-solid.d.ts.map +0 -1
  272. package/dist/tools/scan-solid.js.map +0 -1
  273. package/dist/tools/search-codebase.d.ts.map +0 -1
  274. package/dist/tools/search-codebase.js.map +0 -1
  275. package/dist/tools/server-status.d.ts.map +0 -1
  276. package/dist/tools/server-status.js.map +0 -1
  277. package/dist/tools/shared/scan-types.d.ts +0 -200
  278. package/dist/tools/shared/scan-types.d.ts.map +0 -1
  279. package/dist/tools/shared/scan-types.js +0 -7
  280. package/dist/tools/shared/scan-types.js.map +0 -1
  281. package/dist/tools/suggest-improvements.d.ts.map +0 -1
  282. package/dist/tools/suggest-improvements.js.map +0 -1
  283. package/dist/tools/trace-output-flow.d.ts.map +0 -1
  284. package/dist/tools/trace-output-flow.js.map +0 -1
  285. package/dist/tools/transform-code-batch.d.ts.map +0 -1
  286. package/dist/tools/transform-code-batch.js.map +0 -1
  287. package/dist/tools/transform-code.d.ts.map +0 -1
  288. package/dist/tools/transform-code.js.map +0 -1
  289. package/dist/tools/validate-before-transform.d.ts.map +0 -1
  290. package/dist/tools/validate-before-transform.js.map +0 -1
  291. package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
  292. package/dist/tools/validate-project-compatibility.js.map +0 -1
  293. package/dist/tools/validate-transformation.d.ts.map +0 -1
  294. package/dist/tools/validate-transformation.js.map +0 -1
  295. package/dist/types.d.ts.map +0 -1
  296. package/dist/types.js.map +0 -1
  297. package/dist/utils/format-tool-response.d.ts.map +0 -1
  298. package/dist/utils/format-tool-response.js.map +0 -1
@@ -1,6 +1,20 @@
1
+ import { CallGraphBuilder, } from '@angular-modernizer/api';
2
+ import { existsSync } from 'node:fs';
3
+ import { findTsConfig } from './helpers/find-ts-config.js';
4
+ import { ProjectCache } from './helpers/project-cache.js';
5
+ import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
6
+ /** Direct callers and callees spelled out per list in the summary. */
7
+ const SUMMARY_MAX_NODES = 50;
8
+ const CALL_NODE_FIELDS = {
9
+ name: { type: 'string' },
10
+ file: { type: 'string' },
11
+ line: { type: 'integer' },
12
+ kind: { type: 'string' },
13
+ className: { type: 'string' },
14
+ snippet: { type: 'string' },
15
+ inheritedFrom: { type: 'string' },
16
+ };
1
17
  /**
2
- * @angular-modernizer/adapter-mcp - Get Call Graph Tool
3
- *
4
18
  * MCP tool for building a caller/callee graph for a named method, function,
5
19
  * constructor, get/set accessor or arrow-function property.
6
20
  * Supports configurable traversal direction and depth.
@@ -24,16 +38,16 @@
24
38
  * // projectRoot: '/project', direction: 'down', depth: 4 }
25
39
  * ```
26
40
  */
27
- import { CallGraphBuilder, } from '@angular-modernizer/api';
28
- import { existsSync } from 'node:fs';
29
- import { findTsConfig } from './helpers/find-ts-config.js';
30
- import { ProjectCache } from './helpers/project-cache.js';
31
- /**
32
- * MCP tool that builds a call graph for a named method or function.
33
- */
34
41
  export class GetCallGraphTool {
35
42
  projects;
36
43
  name = 'get-call-graph';
44
+ title = 'Get Call Graph';
45
+ annotations = {
46
+ readOnlyHint: true,
47
+ destructiveHint: false,
48
+ idempotentHint: true,
49
+ openWorldHint: false,
50
+ };
37
51
  constructor(projects = new ProjectCache()) {
38
52
  this.projects = projects;
39
53
  }
@@ -48,11 +62,17 @@ export class GetCallGraphTool {
48
62
  'Callees are resolved via the type checker and include new X() (constructor incl. field initializers), ' +
49
63
  'super(), and property reads that resolve to getters. ' +
50
64
  'Callers of component members include calls from the component template as leaf nodes ' +
51
- '(kind "template", template file and line, snippet). ' +
65
+ '(kind "template", template file and line, snippet), also from templates of subclasses that inherit the member ' +
66
+ '(className of the subclass, inheritedFrom of the declaring class; a subclass overriding it is left out). ' +
52
67
  'Use method "ClassName.constructor" to see what runs transitively during construction. ' +
53
68
  'Use after parse-stack-trace to trace error propagation through the call hierarchy.';
69
+ /**
70
+ * JSON Schema of the tool arguments.
71
+ * @hidden
72
+ */
54
73
  inputSchema = {
55
74
  type: 'object',
75
+ additionalProperties: false,
56
76
  properties: {
57
77
  method: {
58
78
  type: 'string',
@@ -98,6 +118,38 @@ export class GetCallGraphTool {
98
118
  },
99
119
  required: ['method', 'file', 'projectRoot'],
100
120
  };
121
+ /**
122
+ * JSON Schema of the tool result (`structuredContent`).
123
+ * @hidden
124
+ */
125
+ outputSchema = {
126
+ type: 'object',
127
+ $defs: {
128
+ callNode: {
129
+ type: 'object',
130
+ properties: {
131
+ ...CALL_NODE_FIELDS,
132
+ children: { type: 'array', items: { $ref: '#/$defs/callNode' } },
133
+ },
134
+ required: ['name', 'file', 'line', 'children'],
135
+ },
136
+ },
137
+ properties: {
138
+ target: {
139
+ type: ['object', 'null'],
140
+ properties: CALL_NODE_FIELDS,
141
+ required: ['name', 'file', 'line'],
142
+ },
143
+ callers: { type: 'array', items: { $ref: '#/$defs/callNode' } },
144
+ callees: { type: 'array', items: { $ref: '#/$defs/callNode' } },
145
+ nodeCount: { type: 'integer' },
146
+ truncated: { type: 'boolean' },
147
+ truncatedAt: { type: 'integer' },
148
+ summary: { type: 'string' },
149
+ ...WARNINGS_OUTPUT_SCHEMA,
150
+ },
151
+ required: ['target', 'nodeCount', 'truncated', 'summary'],
152
+ };
101
153
  async execute(args) {
102
154
  const params = args;
103
155
  if (!params.method) {
@@ -121,6 +173,7 @@ export class GetCallGraphTool {
121
173
  throw new Error('maxNodes must be a positive integer');
122
174
  }
123
175
  const graphBuilder = new CallGraphBuilder(this.projects.get(tsConfigPath));
176
+ const warnings = this.projects.warnings(tsConfigPath);
124
177
  const options = {
125
178
  direction: params.direction ?? 'both',
126
179
  depth: params.depth ?? 2,
@@ -131,9 +184,9 @@ export class GetCallGraphTool {
131
184
  const summary = this.buildSummary(params.method, result);
132
185
  if (params.summaryOnly) {
133
186
  const { callers: _callers, callees: _callees, ...rest } = result;
134
- return { ...rest, summary };
187
+ return withWarnings({ ...rest, summary }, warnings);
135
188
  }
136
- return { ...result, summary };
189
+ return withWarnings({ ...result, summary }, warnings);
137
190
  }
138
191
  buildSummary(method, result) {
139
192
  if (!result.target) {
@@ -150,27 +203,39 @@ export class GetCallGraphTool {
150
203
  }
151
204
  if (result.callers.length > 0) {
152
205
  lines.push(`\nCallers (${result.callers.length}):`);
153
- for (const c of result.callers) {
154
- lines.push(` ← ${this.label(c)} (${c.file}:${c.line})`);
155
- }
206
+ lines.push(...this.listNodes(result.callers, '←', 'callers'));
156
207
  }
157
208
  else {
158
209
  lines.push('\nNo callers found (root method or not traced).');
159
210
  }
160
211
  if (result.callees.length > 0) {
161
212
  lines.push(`\nCallees (${result.callees.length}):`);
162
- for (const c of result.callees) {
163
- lines.push(` → ${this.label(c)} (${c.file}:${c.line})`);
164
- }
213
+ lines.push(...this.listNodes(result.callees, '→', 'callees'));
165
214
  }
166
215
  else {
167
216
  lines.push('\nNo callees found (leaf method or not traced).');
168
217
  }
169
218
  return lines.join('\n');
170
219
  }
220
+ /**
221
+ * Summary lines for the direct callers or callees, at most
222
+ * {@link SUMMARY_MAX_NODES}: a wide fan-in (500 callers on a large app)
223
+ * made the summary about as large as the tree itself, and the summary is
224
+ * sent as text next to `structuredContent`.
225
+ */
226
+ listNodes(nodes, arrow, field) {
227
+ const lines = nodes
228
+ .slice(0, SUMMARY_MAX_NODES)
229
+ .map((c) => ` ${arrow} ${this.label(c)} (${c.file}:${c.line})`);
230
+ if (nodes.length > SUMMARY_MAX_NODES) {
231
+ lines.push(` ... and ${nodes.length - SUMMARY_MAX_NODES} more in ${field}`);
232
+ }
233
+ return lines;
234
+ }
171
235
  label(node) {
172
236
  if (node.kind === 'template') {
173
- return `template of ${node.className ?? 'component'}: ${node.snippet ?? ''}`;
237
+ const inherited = node.inheritedFrom === undefined ? '' : ` (inherits ${node.inheritedFrom})`;
238
+ return `template of ${node.className ?? 'component'}${inherited}: ${node.snippet ?? ''}`;
174
239
  }
175
240
  const qualified = node.className
176
241
  ? `${node.className}.${node.name}`
@@ -1,17 +1,23 @@
1
+ import type { MCPTool, ToolAnnotations } from '../types.js';
2
+ import { getOperationProgress } from './get-operation-progress.js';
3
+ type OperationProgress = Awaited<ReturnType<typeof getOperationProgress>>;
1
4
  /**
2
- * @angular-modernizer/adapter-mcp - Get Operation Progress Tool
3
- *
4
- * MCP tool for querying progress of streaming operations.
5
- */
6
- import type { MCPTool } from '../types.js';
7
- /**
8
- * MCP tool for getting operation progress.
5
+ * MCP tool for querying the progress of streaming operations (deprecated, kept
6
+ * in 1.x): polls an operation started with `streaming: true` by transform-code
7
+ * or scan-architecture.
9
8
  */
10
9
  export declare class GetOperationProgressTool implements MCPTool {
11
10
  readonly name = "get-operation-progress";
11
+ readonly title = "Get Operation Progress";
12
+ readonly annotations: ToolAnnotations;
12
13
  readonly description: string;
14
+ /**
15
+ * JSON Schema of the tool arguments.
16
+ * @hidden
17
+ */
13
18
  readonly inputSchema: {
14
19
  type: string;
20
+ additionalProperties: boolean;
15
21
  properties: {
16
22
  operationId: {
17
23
  type: string;
@@ -24,6 +30,118 @@ export declare class GetOperationProgressTool implements MCPTool {
24
30
  };
25
31
  required: string[];
26
32
  };
27
- execute(args: Record<string, unknown>): Promise<unknown>;
33
+ /**
34
+ * JSON Schema of the tool result (`structuredContent`).
35
+ * @hidden
36
+ */
37
+ readonly outputSchema: {
38
+ type: string;
39
+ properties: {
40
+ operationId: {
41
+ type: string;
42
+ };
43
+ status: {
44
+ type: string;
45
+ enum: string[];
46
+ };
47
+ events: {
48
+ type: string;
49
+ items: {
50
+ type: string;
51
+ properties: {
52
+ phase: {
53
+ type: string;
54
+ };
55
+ message: {
56
+ type: string;
57
+ };
58
+ percentage: {
59
+ type: string;
60
+ };
61
+ timestamp: {
62
+ type: string;
63
+ };
64
+ unifiedDiff: {
65
+ type: string;
66
+ properties: {
67
+ filePath: {
68
+ type: string;
69
+ };
70
+ diff: {
71
+ type: string;
72
+ };
73
+ linesAdded: {
74
+ type: string;
75
+ };
76
+ linesRemoved: {
77
+ type: string;
78
+ };
79
+ };
80
+ };
81
+ syntaxErrors: {
82
+ type: string;
83
+ items: {
84
+ type: string;
85
+ properties: {
86
+ filePath: {
87
+ type: string;
88
+ };
89
+ line: {
90
+ type: string;
91
+ };
92
+ message: {
93
+ type: string;
94
+ };
95
+ };
96
+ };
97
+ };
98
+ memoryUsage: {
99
+ type: string;
100
+ properties: {
101
+ heapUsed: {
102
+ type: string;
103
+ };
104
+ heapTotal: {
105
+ type: string;
106
+ };
107
+ external: {
108
+ type: string;
109
+ };
110
+ percentage: {
111
+ type: string;
112
+ };
113
+ };
114
+ };
115
+ };
116
+ required: string[];
117
+ };
118
+ };
119
+ totalEvents: {
120
+ type: string;
121
+ };
122
+ elapsedTime: {
123
+ type: string;
124
+ };
125
+ eta: {
126
+ type: string;
127
+ };
128
+ error: {
129
+ type: string;
130
+ };
131
+ result: {
132
+ type: string;
133
+ description: string;
134
+ };
135
+ summary: {
136
+ type: string;
137
+ };
138
+ };
139
+ required: string[];
140
+ };
141
+ execute(args: Record<string, unknown>): Promise<OperationProgress & {
142
+ /** Short text with the status, the last event and the result summary. */
143
+ summary: string;
144
+ }>;
28
145
  }
146
+ export {};
29
147
  //# sourceMappingURL=get-operation-progress-tool.d.ts.map
@@ -1,18 +1,60 @@
1
+ import { getOperationProgress, validateInput, } from './get-operation-progress.js';
1
2
  /**
2
- * @angular-modernizer/adapter-mcp - Get Operation Progress Tool
3
- *
4
- * MCP tool for querying progress of streaming operations.
3
+ * Text summary: status, time, events, the last event, and the stored result's
4
+ * own summary once the operation is completed.
5
5
  */
6
- import { getOperationProgress, validateInput, } from './get-operation-progress.js';
6
+ function describeProgress(progress) {
7
+ const last = progress.events.at(-1);
8
+ const lines = [
9
+ `Operation ${progress.operationId} ${progress.status} after ${(progress.elapsedTime / 1000).toFixed(1)} s; ` +
10
+ `${progress.events.length} of ${progress.totalEvents} event(s)` +
11
+ (progress.eta === undefined
12
+ ? ''
13
+ : `; eta ${(progress.eta / 1000).toFixed(1)} s`) +
14
+ '.',
15
+ ];
16
+ if (last !== undefined) {
17
+ lines.push(`Last event: ${last.phase} ${last.percentage}%: ${last.message}`);
18
+ }
19
+ if (progress.error !== undefined) {
20
+ lines.push(`Error: ${progress.error}`);
21
+ }
22
+ const result = progress.result;
23
+ if (typeof result === 'object' && result !== null && 'summary' in result) {
24
+ const inner = result.summary;
25
+ if (typeof inner === 'string') {
26
+ lines.push(`Result: ${inner}`);
27
+ }
28
+ }
29
+ return lines.join('\n');
30
+ }
7
31
  /**
8
- * MCP tool for getting operation progress.
32
+ * MCP tool for querying the progress of streaming operations (deprecated, kept
33
+ * in 1.x): polls an operation started with `streaming: true` by transform-code
34
+ * or scan-architecture.
9
35
  */
10
36
  export class GetOperationProgressTool {
11
37
  name = 'get-operation-progress';
12
- description = 'Get progress for a streaming operation (transformation or analysis). ' +
13
- 'Returns status, events, and operation metadata including diffs and syntax errors.';
38
+ title = 'Get Operation Progress';
39
+ annotations = {
40
+ readOnlyHint: true,
41
+ destructiveHint: false,
42
+ idempotentHint: true,
43
+ openWorldHint: false,
44
+ };
45
+ description = 'Deprecated, kept in 1.x: polls an operation started with streaming: true (transform-code, scan-architecture). ' +
46
+ 'Call those tools synchronously instead: they send MCP progress notifications when the request has a progressToken ' +
47
+ 'and stop on notifications/cancelled. ' +
48
+ 'Get progress for a streaming operation (transformation or analysis). ' +
49
+ 'Returns status, events, and operation metadata including diffs and syntax errors. ' +
50
+ 'A completed operation carries the tool result in result; summary is a short text with the status, the last event and the result summary.';
51
+ /**
52
+ * JSON Schema of the tool arguments.
53
+ * @hidden
54
+ */
14
55
  inputSchema = {
15
56
  type: 'object',
57
+ additionalProperties: false,
16
58
  properties: {
17
59
  operationId: {
18
60
  type: 'string',
@@ -25,12 +67,82 @@ export class GetOperationProgressTool {
25
67
  },
26
68
  required: ['operationId'],
27
69
  };
70
+ /**
71
+ * JSON Schema of the tool result (`structuredContent`).
72
+ * @hidden
73
+ */
74
+ outputSchema = {
75
+ type: 'object',
76
+ properties: {
77
+ operationId: { type: 'string' },
78
+ status: {
79
+ type: 'string',
80
+ enum: ['running', 'completed', 'failed', 'cancelled'],
81
+ },
82
+ events: {
83
+ type: 'array',
84
+ items: {
85
+ type: 'object',
86
+ properties: {
87
+ phase: { type: 'string' },
88
+ message: { type: 'string' },
89
+ percentage: { type: 'number' },
90
+ timestamp: { type: 'number' },
91
+ unifiedDiff: {
92
+ type: 'object',
93
+ properties: {
94
+ filePath: { type: 'string' },
95
+ diff: { type: 'string' },
96
+ linesAdded: { type: 'integer' },
97
+ linesRemoved: { type: 'integer' },
98
+ },
99
+ },
100
+ syntaxErrors: {
101
+ type: 'array',
102
+ items: {
103
+ type: 'object',
104
+ properties: {
105
+ filePath: { type: 'string' },
106
+ line: { type: 'integer' },
107
+ message: { type: 'string' },
108
+ },
109
+ },
110
+ },
111
+ memoryUsage: {
112
+ type: 'object',
113
+ properties: {
114
+ heapUsed: { type: 'number' },
115
+ heapTotal: { type: 'number' },
116
+ external: { type: 'number' },
117
+ percentage: { type: 'number' },
118
+ },
119
+ },
120
+ },
121
+ required: ['phase', 'message', 'percentage', 'timestamp'],
122
+ },
123
+ },
124
+ totalEvents: { type: 'integer' },
125
+ elapsedTime: { type: 'number' },
126
+ eta: { type: 'number' },
127
+ error: { type: 'string' },
128
+ result: {
129
+ type: 'object',
130
+ description: 'Result of the operation as the tool returns it (scan-architecture, transform-code), only when completed.',
131
+ },
132
+ summary: { type: 'string' },
133
+ },
134
+ required: [
135
+ 'operationId',
136
+ 'status',
137
+ 'events',
138
+ 'totalEvents',
139
+ 'elapsedTime',
140
+ 'summary',
141
+ ],
142
+ };
28
143
  async execute(args) {
29
- // Validate input
30
- const validatedInput = validateInput(args);
31
- // Execute the operation
32
- const result = await getOperationProgress(validatedInput);
33
- return result;
144
+ const progress = await getOperationProgress(validateInput(args));
145
+ return { ...progress, summary: describeProgress(progress) };
34
146
  }
35
147
  }
36
148
  //# sourceMappingURL=get-operation-progress-tool.js.map
@@ -17,35 +17,61 @@ export declare function validateInput(input: unknown): GetOperationProgressInput
17
17
  * Returns status, events, and operation metadata
18
18
  */
19
19
  export declare function getOperationProgress(input: GetOperationProgressInput): Promise<{
20
+ /** Operation id. */
20
21
  operationId: string;
22
+ /** Lifecycle status of the operation. */
21
23
  status: 'running' | 'completed' | 'failed' | 'cancelled';
24
+ /** Progress events, only those after `sinceTimestamp` when given. */
22
25
  events: {
26
+ /** Phase of the operation. */
23
27
  phase: string;
28
+ /** Progress message. */
24
29
  message: string;
30
+ /** Progress in percent (0 to 100). */
25
31
  percentage: number;
32
+ /** Time of the event in milliseconds since the epoch. */
26
33
  timestamp: number;
27
- diff?: {
34
+ /** Unified diff of a transformed file. */
35
+ unifiedDiff?: {
36
+ /** Path of the changed file. */
28
37
  filePath: string;
38
+ /** Diff text in unified format. */
29
39
  diff: string;
40
+ /** Number of added lines. */
30
41
  linesAdded: number;
42
+ /** Number of removed lines. */
31
43
  linesRemoved: number;
32
44
  };
45
+ /** Syntax errors found in transformed code. */
33
46
  syntaxErrors?: {
47
+ /** File with the error. */
34
48
  filePath: string;
49
+ /** Line of the error. */
35
50
  line: number;
51
+ /** Error message. */
36
52
  message: string;
37
53
  }[];
54
+ /** Memory usage of the process at the event. */
38
55
  memoryUsage?: {
56
+ /** V8 heap in use, bytes. */
39
57
  heapUsed: number;
58
+ /** V8 heap allocated, bytes. */
40
59
  heapTotal: number;
60
+ /** Memory of C++ objects bound to JavaScript objects, bytes. */
41
61
  external: number;
62
+ /** Heap in use as percent of the heap allocated. */
42
63
  percentage: number;
43
64
  };
44
65
  }[];
66
+ /** Number of all events of the operation, regardless of `sinceTimestamp`. */
45
67
  totalEvents: number;
68
+ /** Milliseconds since the operation started. */
46
69
  elapsedTime: number;
70
+ /** Estimated milliseconds until completion; only for running operations with progress. */
47
71
  eta?: number;
72
+ /** Error message of a failed operation. */
48
73
  error?: string;
74
+ /** Stored result of a completed operation. */
49
75
  result?: unknown;
50
76
  }>;
51
77
  //# sourceMappingURL=get-operation-progress.d.ts.map
@@ -59,12 +59,12 @@ export async function getOperationProgress(input) {
59
59
  message: event.message,
60
60
  percentage: event.percentage,
61
61
  timestamp: event.timestamp,
62
- diff: event.diff
62
+ unifiedDiff: event.unifiedDiff
63
63
  ? {
64
- filePath: event.diff.filePath,
65
- diff: event.diff.diff,
66
- linesAdded: event.diff.linesAdded,
67
- linesRemoved: event.diff.linesRemoved,
64
+ filePath: event.unifiedDiff.filePath,
65
+ diff: event.unifiedDiff.diff,
66
+ linesAdded: event.unifiedDiff.linesAdded,
67
+ linesRemoved: event.unifiedDiff.linesRemoved,
68
68
  }
69
69
  : undefined,
70
70
  syntaxErrors: event.syntaxErrors