@angular-modernizer/adapter-mcp 0.3.0 → 1.0.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 (275) hide show
  1. package/README.md +103 -218
  2. package/dist/cli.js +13 -13
  3. package/dist/index.d.ts +4 -3
  4. package/dist/index.js +3 -2
  5. package/dist/mcp-watcher.d.ts +6 -1
  6. package/dist/mcp-watcher.js +11 -10
  7. package/dist/server/limited-stdio-transport.d.ts +68 -0
  8. package/dist/server/limited-stdio-transport.js +115 -0
  9. package/dist/server/mcp-server.d.ts +12 -14
  10. package/dist/server/mcp-server.js +41 -75
  11. package/dist/server/package-version.d.ts +16 -0
  12. package/dist/server/package-version.js +37 -0
  13. package/dist/server/sdk-server.d.ts +70 -0
  14. package/dist/server/sdk-server.js +113 -0
  15. package/dist/server/tool-registry.d.ts +3 -2
  16. package/dist/server/tool-registry.js +5 -5
  17. package/dist/tools/analyze-build-impact.d.ts +220 -1
  18. package/dist/tools/analyze-build-impact.js +145 -3
  19. package/dist/tools/analyze-core-to-shared.d.ts +134 -4
  20. package/dist/tools/analyze-core-to-shared.js +113 -9
  21. package/dist/tools/analyze-parser-performance.d.ts +200 -7
  22. package/dist/tools/analyze-parser-performance.js +108 -47
  23. package/dist/tools/analyze-project.d.ts +267 -5
  24. package/dist/tools/analyze-project.js +196 -8
  25. package/dist/tools/check-incremental-compatibility.d.ts +61 -1
  26. package/dist/tools/check-incremental-compatibility.js +58 -2
  27. package/dist/tools/collect-feedback.d.ts +199 -10
  28. package/dist/tools/collect-feedback.js +171 -99
  29. package/dist/tools/compare-health.d.ts +356 -0
  30. package/dist/tools/compare-health.js +472 -0
  31. package/dist/tools/extract-libraries.d.ts +156 -4
  32. package/dist/tools/extract-libraries.js +115 -10
  33. package/dist/tools/find-angular-symbol.d.ts +69 -3
  34. package/dist/tools/find-angular-symbol.js +55 -8
  35. package/dist/tools/find-component-hosts.d.ts +572 -2
  36. package/dist/tools/find-component-hosts.js +207 -6
  37. package/dist/tools/find-usages.d.ts +79 -1
  38. package/dist/tools/find-usages.js +64 -7
  39. package/dist/tools/get-bootstrap-execution.d.ts +151 -1
  40. package/dist/tools/get-bootstrap-execution.js +84 -3
  41. package/dist/tools/get-call-graph.d.ts +111 -1
  42. package/dist/tools/get-call-graph.js +72 -10
  43. package/dist/tools/get-operation-progress-tool.d.ts +114 -2
  44. package/dist/tools/get-operation-progress-tool.js +114 -7
  45. package/dist/tools/get-operation-progress.d.ts +1 -1
  46. package/dist/tools/get-operation-progress.js +5 -5
  47. package/dist/tools/helpers/analysis-output.d.ts +177 -0
  48. package/dist/tools/helpers/analysis-output.js +165 -0
  49. package/dist/tools/helpers/build-schemas.d.ts +36 -0
  50. package/dist/tools/helpers/build-schemas.js +23 -0
  51. package/dist/tools/helpers/citation-file-source.d.ts +10 -0
  52. package/dist/tools/helpers/citation-file-source.js +82 -0
  53. package/dist/tools/helpers/finding-window.d.ts +43 -0
  54. package/dist/tools/helpers/finding-window.js +64 -0
  55. package/dist/tools/helpers/health-delta.d.ts +86 -0
  56. package/dist/tools/helpers/health-delta.js +239 -0
  57. package/dist/tools/helpers/investigation-schemas.d.ts +93 -0
  58. package/dist/tools/helpers/investigation-schemas.js +48 -0
  59. package/dist/tools/helpers/library-imports.d.ts +57 -0
  60. package/dist/tools/helpers/library-imports.js +151 -0
  61. package/dist/tools/helpers/load-source-files.d.ts +30 -0
  62. package/dist/tools/helpers/load-source-files.js +34 -0
  63. package/dist/tools/helpers/output-contract.d.ts +32 -0
  64. package/dist/tools/helpers/output-contract.js +32 -0
  65. package/dist/tools/helpers/platform-root-resolver.d.ts +55 -25
  66. package/dist/tools/helpers/platform-root-resolver.js +75 -48
  67. package/dist/tools/helpers/process-output.d.ts +19 -0
  68. package/dist/tools/helpers/process-output.js +31 -0
  69. package/dist/tools/helpers/project-cache.d.ts +11 -4
  70. package/dist/tools/helpers/project-cache.js +22 -4
  71. package/dist/tools/helpers/project-decorators.d.ts +14 -0
  72. package/dist/tools/helpers/project-decorators.js +22 -0
  73. package/dist/tools/helpers/rule-matcher.js +5 -0
  74. package/dist/tools/helpers/rule-runner.d.ts +9 -4
  75. package/dist/tools/helpers/rule-runner.js +28 -14
  76. package/dist/tools/helpers/scan-cache.d.ts +22 -0
  77. package/dist/tools/helpers/scan-cache.js +34 -0
  78. package/dist/tools/helpers/scan-plan.d.ts +5 -2
  79. package/dist/tools/helpers/scan-plan.js +18 -3
  80. package/dist/tools/helpers/scope-paths.d.ts +17 -0
  81. package/dist/tools/helpers/scope-paths.js +32 -0
  82. package/dist/tools/helpers/tool-context.d.ts +60 -0
  83. package/dist/tools/helpers/tool-context.js +82 -0
  84. package/dist/tools/helpers/transform-safety.d.ts +40 -0
  85. package/dist/tools/helpers/transform-safety.js +87 -0
  86. package/dist/tools/helpers/validation-output.d.ts +53 -0
  87. package/dist/tools/helpers/validation-output.js +48 -0
  88. package/dist/tools/inspect-form-group.d.ts +232 -1
  89. package/dist/tools/inspect-form-group.js +120 -2
  90. package/dist/tools/inspect-i18n.d.ts +382 -1
  91. package/dist/tools/inspect-i18n.js +199 -2
  92. package/dist/tools/inspect-template.d.ts +232 -1
  93. package/dist/tools/inspect-template.js +160 -2
  94. package/dist/tools/learn-patterns.d.ts +122 -1
  95. package/dist/tools/learn-patterns.js +97 -2
  96. package/dist/tools/list-imports.d.ts +111 -10
  97. package/dist/tools/list-imports.js +110 -7
  98. package/dist/tools/orchestrate-migration.d.ts +128 -5
  99. package/dist/tools/orchestrate-migration.js +135 -13
  100. package/dist/tools/parse-stack-trace.d.ts +56 -1
  101. package/dist/tools/parse-stack-trace.js +34 -0
  102. package/dist/tools/plan-migration.d.ts +330 -1
  103. package/dist/tools/plan-migration.js +154 -3
  104. package/dist/tools/resolve-type.d.ts +39 -1
  105. package/dist/tools/resolve-type.js +31 -2
  106. package/dist/tools/review-feedback.d.ts +206 -11
  107. package/dist/tools/review-feedback.js +132 -51
  108. package/dist/tools/rollback-changes.d.ts +79 -2
  109. package/dist/tools/rollback-changes.js +66 -14
  110. package/dist/tools/run-angular-cli.d.ts +45 -2
  111. package/dist/tools/run-angular-cli.js +67 -7
  112. package/dist/tools/run-build.d.ts +114 -2
  113. package/dist/tools/run-build.js +117 -8
  114. package/dist/tools/run-schematic.d.ts +70 -2
  115. package/dist/tools/run-schematic.js +104 -10
  116. package/dist/tools/scan-all.d.ts +19 -11
  117. package/dist/tools/scan-all.js +139 -131
  118. package/dist/tools/scan-angular.d.ts +19 -10
  119. package/dist/tools/scan-angular.js +51 -23
  120. package/dist/tools/scan-architecture.d.ts +17 -10
  121. package/dist/tools/scan-architecture.js +93 -31
  122. package/dist/tools/scan-solid.d.ts +19 -10
  123. package/dist/tools/scan-solid.js +51 -23
  124. package/dist/tools/search-codebase.d.ts +82 -1
  125. package/dist/tools/search-codebase.js +55 -2
  126. package/dist/tools/server-status.d.ts +279 -5
  127. package/dist/tools/server-status.js +179 -5
  128. package/dist/tools/suggest-improvements.d.ts +97 -5
  129. package/dist/tools/suggest-improvements.js +80 -44
  130. package/dist/tools/trace-output-flow.d.ts +682 -2
  131. package/dist/tools/trace-output-flow.js +375 -15
  132. package/dist/tools/transform-code-batch.d.ts +3 -0
  133. package/dist/tools/transform-code-batch.js +10 -5
  134. package/dist/tools/transform-code.d.ts +335 -12
  135. package/dist/tools/transform-code.js +649 -608
  136. package/dist/tools/validate-before-transform.d.ts +116 -2
  137. package/dist/tools/validate-before-transform.js +55 -2
  138. package/dist/tools/validate-project-compatibility.d.ts +64 -2
  139. package/dist/tools/validate-project-compatibility.js +67 -4
  140. package/dist/tools/validate-transformation.d.ts +220 -2
  141. package/dist/tools/validate-transformation.js +113 -15
  142. package/dist/tools/verify-citations.d.ts +181 -0
  143. package/dist/tools/verify-citations.js +218 -0
  144. package/dist/types.d.ts +38 -1
  145. package/dist/utils/format-tool-response.d.ts +22 -59
  146. package/dist/utils/format-tool-response.js +25 -134
  147. package/package.json +30 -13
  148. package/dist/cli.d.ts.map +0 -1
  149. package/dist/cli.js.map +0 -1
  150. package/dist/core/project-analyzer.d.ts.map +0 -1
  151. package/dist/core/project-analyzer.js.map +0 -1
  152. package/dist/index.d.ts.map +0 -1
  153. package/dist/index.js.map +0 -1
  154. package/dist/mcp-watcher.d.ts.map +0 -1
  155. package/dist/mcp-watcher.js.map +0 -1
  156. package/dist/server/json-rpc-handler.d.ts +0 -98
  157. package/dist/server/json-rpc-handler.d.ts.map +0 -1
  158. package/dist/server/json-rpc-handler.js +0 -301
  159. package/dist/server/json-rpc-handler.js.map +0 -1
  160. package/dist/server/mcp-server.d.ts.map +0 -1
  161. package/dist/server/mcp-server.js.map +0 -1
  162. package/dist/server/stdio-guard.d.ts.map +0 -1
  163. package/dist/server/stdio-guard.js.map +0 -1
  164. package/dist/server/tool-registry.d.ts.map +0 -1
  165. package/dist/server/tool-registry.js.map +0 -1
  166. package/dist/streaming/progress-store.d.ts.map +0 -1
  167. package/dist/streaming/progress-store.js.map +0 -1
  168. package/dist/tools/analyze-build-impact.d.ts.map +0 -1
  169. package/dist/tools/analyze-build-impact.js.map +0 -1
  170. package/dist/tools/analyze-core-to-shared.d.ts.map +0 -1
  171. package/dist/tools/analyze-core-to-shared.js.map +0 -1
  172. package/dist/tools/analyze-parser-performance.d.ts.map +0 -1
  173. package/dist/tools/analyze-parser-performance.js.map +0 -1
  174. package/dist/tools/analyze-project.d.ts.map +0 -1
  175. package/dist/tools/analyze-project.js.map +0 -1
  176. package/dist/tools/check-incremental-compatibility.d.ts.map +0 -1
  177. package/dist/tools/check-incremental-compatibility.js.map +0 -1
  178. package/dist/tools/collect-feedback.d.ts.map +0 -1
  179. package/dist/tools/collect-feedback.js.map +0 -1
  180. package/dist/tools/extract-libraries.d.ts.map +0 -1
  181. package/dist/tools/extract-libraries.js.map +0 -1
  182. package/dist/tools/find-angular-symbol.d.ts.map +0 -1
  183. package/dist/tools/find-angular-symbol.js.map +0 -1
  184. package/dist/tools/find-component-hosts.d.ts.map +0 -1
  185. package/dist/tools/find-component-hosts.js.map +0 -1
  186. package/dist/tools/find-usages.d.ts.map +0 -1
  187. package/dist/tools/find-usages.js.map +0 -1
  188. package/dist/tools/get-bootstrap-execution.d.ts.map +0 -1
  189. package/dist/tools/get-bootstrap-execution.js.map +0 -1
  190. package/dist/tools/get-call-graph.d.ts.map +0 -1
  191. package/dist/tools/get-call-graph.js.map +0 -1
  192. package/dist/tools/get-operation-progress-tool.d.ts.map +0 -1
  193. package/dist/tools/get-operation-progress-tool.js.map +0 -1
  194. package/dist/tools/get-operation-progress.d.ts.map +0 -1
  195. package/dist/tools/get-operation-progress.js.map +0 -1
  196. package/dist/tools/helpers/compact-output.d.ts.map +0 -1
  197. package/dist/tools/helpers/compact-output.js.map +0 -1
  198. package/dist/tools/helpers/feedback-analyzer.d.ts.map +0 -1
  199. package/dist/tools/helpers/feedback-analyzer.js.map +0 -1
  200. package/dist/tools/helpers/find-ts-config.d.ts.map +0 -1
  201. package/dist/tools/helpers/find-ts-config.js.map +0 -1
  202. package/dist/tools/helpers/platform-root-resolver.d.ts.map +0 -1
  203. package/dist/tools/helpers/platform-root-resolver.js.map +0 -1
  204. package/dist/tools/helpers/project-cache.d.ts.map +0 -1
  205. package/dist/tools/helpers/project-cache.js.map +0 -1
  206. package/dist/tools/helpers/rule-matcher.d.ts.map +0 -1
  207. package/dist/tools/helpers/rule-matcher.js.map +0 -1
  208. package/dist/tools/helpers/rule-runner.d.ts.map +0 -1
  209. package/dist/tools/helpers/rule-runner.js.map +0 -1
  210. package/dist/tools/helpers/scan-plan.d.ts.map +0 -1
  211. package/dist/tools/helpers/scan-plan.js.map +0 -1
  212. package/dist/tools/helpers/stack-frame-file-index.d.ts.map +0 -1
  213. package/dist/tools/helpers/stack-frame-file-index.js.map +0 -1
  214. package/dist/tools/helpers/suggestion-generator.d.ts.map +0 -1
  215. package/dist/tools/helpers/suggestion-generator.js.map +0 -1
  216. package/dist/tools/inspect-form-group.d.ts.map +0 -1
  217. package/dist/tools/inspect-form-group.js.map +0 -1
  218. package/dist/tools/inspect-i18n.d.ts.map +0 -1
  219. package/dist/tools/inspect-i18n.js.map +0 -1
  220. package/dist/tools/inspect-template.d.ts.map +0 -1
  221. package/dist/tools/inspect-template.js.map +0 -1
  222. package/dist/tools/learn-patterns.d.ts.map +0 -1
  223. package/dist/tools/learn-patterns.js.map +0 -1
  224. package/dist/tools/list-imports.d.ts.map +0 -1
  225. package/dist/tools/list-imports.js.map +0 -1
  226. package/dist/tools/orchestrate-migration.d.ts.map +0 -1
  227. package/dist/tools/orchestrate-migration.js.map +0 -1
  228. package/dist/tools/parse-stack-trace.d.ts.map +0 -1
  229. package/dist/tools/parse-stack-trace.js.map +0 -1
  230. package/dist/tools/plan-migration.d.ts.map +0 -1
  231. package/dist/tools/plan-migration.js.map +0 -1
  232. package/dist/tools/resolve-type.d.ts.map +0 -1
  233. package/dist/tools/resolve-type.js.map +0 -1
  234. package/dist/tools/review-feedback.d.ts.map +0 -1
  235. package/dist/tools/review-feedback.js.map +0 -1
  236. package/dist/tools/rollback-changes.d.ts.map +0 -1
  237. package/dist/tools/rollback-changes.js.map +0 -1
  238. package/dist/tools/run-angular-cli.d.ts.map +0 -1
  239. package/dist/tools/run-angular-cli.js.map +0 -1
  240. package/dist/tools/run-build.d.ts.map +0 -1
  241. package/dist/tools/run-build.js.map +0 -1
  242. package/dist/tools/run-schematic.d.ts.map +0 -1
  243. package/dist/tools/run-schematic.js.map +0 -1
  244. package/dist/tools/scan-all.d.ts.map +0 -1
  245. package/dist/tools/scan-all.js.map +0 -1
  246. package/dist/tools/scan-angular.d.ts.map +0 -1
  247. package/dist/tools/scan-angular.js.map +0 -1
  248. package/dist/tools/scan-architecture.d.ts.map +0 -1
  249. package/dist/tools/scan-architecture.js.map +0 -1
  250. package/dist/tools/scan-solid.d.ts.map +0 -1
  251. package/dist/tools/scan-solid.js.map +0 -1
  252. package/dist/tools/search-codebase.d.ts.map +0 -1
  253. package/dist/tools/search-codebase.js.map +0 -1
  254. package/dist/tools/server-status.d.ts.map +0 -1
  255. package/dist/tools/server-status.js.map +0 -1
  256. package/dist/tools/shared/scan-types.d.ts.map +0 -1
  257. package/dist/tools/shared/scan-types.js.map +0 -1
  258. package/dist/tools/suggest-improvements.d.ts.map +0 -1
  259. package/dist/tools/suggest-improvements.js.map +0 -1
  260. package/dist/tools/trace-output-flow.d.ts.map +0 -1
  261. package/dist/tools/trace-output-flow.js.map +0 -1
  262. package/dist/tools/transform-code-batch.d.ts.map +0 -1
  263. package/dist/tools/transform-code-batch.js.map +0 -1
  264. package/dist/tools/transform-code.d.ts.map +0 -1
  265. package/dist/tools/transform-code.js.map +0 -1
  266. package/dist/tools/validate-before-transform.d.ts.map +0 -1
  267. package/dist/tools/validate-before-transform.js.map +0 -1
  268. package/dist/tools/validate-project-compatibility.d.ts.map +0 -1
  269. package/dist/tools/validate-project-compatibility.js.map +0 -1
  270. package/dist/tools/validate-transformation.d.ts.map +0 -1
  271. package/dist/tools/validate-transformation.js.map +0 -1
  272. package/dist/types.d.ts.map +0 -1
  273. package/dist/types.js.map +0 -1
  274. package/dist/utils/format-tool-response.d.ts.map +0 -1
  275. package/dist/utils/format-tool-response.js.map +0 -1
@@ -19,7 +19,7 @@
19
19
  * // args: { projectRoot: '/project', watch: ['AppConfig.settings'], summaryOnly: true }
20
20
  * ```
21
21
  */
22
- import { type MCPTool } from '../types.js';
22
+ import { type MCPTool, type ToolAnnotations } from '../types.js';
23
23
  import { type BootstrapExecutionResult, type BootstrapRoot, type BootstrapTiming, type BootstrapWatchHit } from '@angular-modernizer/api';
24
24
  import { ProjectCache } from './helpers/project-cache.js';
25
25
  /** A root with its reached list optionally dropped or capped. */
@@ -37,6 +37,8 @@ interface GetBootstrapExecutionOutput {
37
37
  truncated: boolean;
38
38
  summary: string;
39
39
  tsConfigPath: string;
40
+ /** Conditions that can make the result incomplete (unresolved library imports). */
41
+ warnings?: string[];
40
42
  }
41
43
  /**
42
44
  * MCP tool that reports what runs at application startup.
@@ -44,10 +46,13 @@ interface GetBootstrapExecutionOutput {
44
46
  export declare class GetBootstrapExecutionTool implements MCPTool {
45
47
  private readonly projects;
46
48
  readonly name = "get-bootstrap-execution";
49
+ readonly title = "Get Bootstrap Execution";
50
+ readonly annotations: ToolAnnotations;
47
51
  constructor(projects?: ProjectCache);
48
52
  readonly description: string;
49
53
  readonly inputSchema: {
50
54
  type: string;
55
+ additionalProperties: boolean;
51
56
  properties: {
52
57
  summaryOnly: {
53
58
  readonly type: "boolean";
@@ -101,6 +106,151 @@ export declare class GetBootstrapExecutionTool implements MCPTool {
101
106
  };
102
107
  required: string[];
103
108
  };
109
+ readonly outputSchema: {
110
+ type: string;
111
+ properties: {
112
+ warnings: {
113
+ readonly type: "array";
114
+ readonly items: {
115
+ readonly type: "string";
116
+ };
117
+ readonly description: "Conditions that can make the result incomplete, e.g. library imports that do not resolve because node_modules is missing.";
118
+ };
119
+ roots: {
120
+ type: string;
121
+ items: {
122
+ type: string;
123
+ properties: {
124
+ kind: {
125
+ type: string;
126
+ };
127
+ timing: {
128
+ type: string;
129
+ };
130
+ label: {
131
+ type: string;
132
+ };
133
+ file: {
134
+ type: string;
135
+ };
136
+ line: {
137
+ type: string;
138
+ };
139
+ unresolvedInjections: {
140
+ readonly type: "array";
141
+ readonly items: {
142
+ readonly type: "string";
143
+ };
144
+ };
145
+ truncated: {
146
+ type: string;
147
+ };
148
+ reached: {
149
+ type: string;
150
+ items: {
151
+ type: string;
152
+ properties: {
153
+ name: {
154
+ type: string;
155
+ };
156
+ kind: {
157
+ type: string;
158
+ };
159
+ file: {
160
+ type: string;
161
+ };
162
+ line: {
163
+ type: string;
164
+ };
165
+ depth: {
166
+ type: string;
167
+ };
168
+ via: {
169
+ type: string;
170
+ };
171
+ };
172
+ required: string[];
173
+ };
174
+ };
175
+ reachedCount: {
176
+ type: string;
177
+ };
178
+ };
179
+ required: string[];
180
+ };
181
+ };
182
+ watchHits: {
183
+ type: string;
184
+ items: {
185
+ type: string;
186
+ properties: {
187
+ watch: {
188
+ type: string;
189
+ };
190
+ access: {
191
+ type: string;
192
+ };
193
+ root: {
194
+ type: string;
195
+ };
196
+ timing: {
197
+ type: string;
198
+ };
199
+ path: {
200
+ readonly type: "array";
201
+ readonly items: {
202
+ readonly type: "string";
203
+ };
204
+ };
205
+ file: {
206
+ type: string;
207
+ };
208
+ line: {
209
+ type: string;
210
+ };
211
+ snippet: {
212
+ type: string;
213
+ };
214
+ };
215
+ required: string[];
216
+ };
217
+ };
218
+ counts: {
219
+ type: string;
220
+ properties: {
221
+ roots: {
222
+ type: string;
223
+ };
224
+ rootsByTiming: {
225
+ readonly type: "object";
226
+ readonly additionalProperties: {
227
+ readonly type: "integer";
228
+ };
229
+ };
230
+ reached: {
231
+ type: string;
232
+ };
233
+ watchHits: {
234
+ type: string;
235
+ };
236
+ truncatedRoots: {
237
+ type: string;
238
+ };
239
+ };
240
+ required: string[];
241
+ };
242
+ truncated: {
243
+ type: string;
244
+ };
245
+ summary: {
246
+ type: string;
247
+ };
248
+ tsConfigPath: {
249
+ type: string;
250
+ };
251
+ };
252
+ required: string[];
253
+ };
104
254
  execute(args: Record<string, unknown>): Promise<GetBootstrapExecutionOutput>;
105
255
  private buildSummary;
106
256
  }
@@ -25,6 +25,8 @@ import { isAbsolute, relative, resolve } from 'node:path';
25
25
  import { findTsConfig } from './helpers/find-ts-config.js';
26
26
  import { ProjectCache } from './helpers/project-cache.js';
27
27
  import { COMPACT_OUTPUT_SCHEMA, limitList, parseCompactOptions, } from './helpers/compact-output.js';
28
+ import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
29
+ import { COUNT_OBJECT, STRING_ARRAY } from './helpers/investigation-schemas.js';
28
30
  const TIMINGS = [
29
31
  'initializer',
30
32
  'bootstrap',
@@ -73,6 +75,13 @@ function stringList(value, name) {
73
75
  export class GetBootstrapExecutionTool {
74
76
  projects;
75
77
  name = 'get-bootstrap-execution';
78
+ title = 'Get Bootstrap Execution';
79
+ annotations = {
80
+ readOnlyHint: true,
81
+ destructiveHint: false,
82
+ idempotentHint: true,
83
+ openWorldHint: false,
84
+ };
76
85
  constructor(projects = new ProjectCache()) {
77
86
  this.projects = projects;
78
87
  }
@@ -90,6 +99,7 @@ export class GetBootstrapExecutionTool {
90
99
  'maxResults caps the reached list per root and the watch hits.';
91
100
  inputSchema = {
92
101
  type: 'object',
102
+ additionalProperties: false,
93
103
  properties: {
94
104
  projectRoot: {
95
105
  type: 'string',
@@ -130,6 +140,76 @@ export class GetBootstrapExecutionTool {
130
140
  },
131
141
  required: ['projectRoot'],
132
142
  };
143
+ outputSchema = {
144
+ type: 'object',
145
+ properties: {
146
+ roots: {
147
+ type: 'array',
148
+ items: {
149
+ type: 'object',
150
+ properties: {
151
+ kind: { type: 'string' },
152
+ timing: { type: 'string' },
153
+ label: { type: 'string' },
154
+ file: { type: 'string' },
155
+ line: { type: 'integer' },
156
+ unresolvedInjections: STRING_ARRAY,
157
+ truncated: { type: 'boolean' },
158
+ reached: {
159
+ type: 'array',
160
+ items: {
161
+ type: 'object',
162
+ properties: {
163
+ name: { type: 'string' },
164
+ kind: { type: 'string' },
165
+ file: { type: 'string' },
166
+ line: { type: 'integer' },
167
+ depth: { type: 'integer' },
168
+ via: { type: 'string' },
169
+ },
170
+ required: ['name', 'kind', 'file', 'line', 'depth', 'via'],
171
+ },
172
+ },
173
+ reachedCount: { type: 'integer' },
174
+ },
175
+ required: ['kind', 'timing', 'label', 'file', 'line', 'unresolvedInjections', 'truncated', 'reachedCount'],
176
+ },
177
+ },
178
+ watchHits: {
179
+ type: 'array',
180
+ items: {
181
+ type: 'object',
182
+ properties: {
183
+ watch: { type: 'string' },
184
+ access: { type: 'string' },
185
+ root: { type: 'string' },
186
+ timing: { type: 'string' },
187
+ path: STRING_ARRAY,
188
+ file: { type: 'string' },
189
+ line: { type: 'integer' },
190
+ snippet: { type: 'string' },
191
+ },
192
+ required: ['watch', 'access', 'root', 'timing', 'path', 'file', 'line', 'snippet'],
193
+ },
194
+ },
195
+ counts: {
196
+ type: 'object',
197
+ properties: {
198
+ roots: { type: 'integer' },
199
+ rootsByTiming: COUNT_OBJECT,
200
+ reached: { type: 'integer' },
201
+ watchHits: { type: 'integer' },
202
+ truncatedRoots: { type: 'integer' },
203
+ },
204
+ required: ['roots', 'rootsByTiming', 'reached', 'watchHits', 'truncatedRoots'],
205
+ },
206
+ truncated: { type: 'boolean' },
207
+ summary: { type: 'string' },
208
+ tsConfigPath: { type: 'string' },
209
+ ...WARNINGS_OUTPUT_SCHEMA,
210
+ },
211
+ required: ['counts', 'truncated', 'summary', 'tsConfigPath'],
212
+ };
133
213
  async execute(args) {
134
214
  const params = args;
135
215
  if (!params.projectRoot) {
@@ -166,8 +246,9 @@ export class GetBootstrapExecutionTool {
166
246
  ...(maxNodes === undefined ? {} : { maxNodes }),
167
247
  });
168
248
  const summary = this.buildSummary(result, params.projectRoot, watch ?? [], params.method);
249
+ const warnings = this.projects.warnings(tsConfigPath);
169
250
  if (compact.summaryOnly) {
170
- return { counts: result.counts, truncated: false, summary, tsConfigPath };
251
+ return withWarnings({ counts: result.counts, truncated: false, summary, tsConfigPath }, warnings);
171
252
  }
172
253
  const includeReached = params.includeReached !== false;
173
254
  let truncated = false;
@@ -182,14 +263,14 @@ export class GetBootstrapExecutionTool {
182
263
  });
183
264
  const hits = limitList(result.watchHits, compact.maxResults);
184
265
  truncated ||= hits.truncated;
185
- return {
266
+ return withWarnings({
186
267
  roots,
187
268
  watchHits: hits.items,
188
269
  counts: result.counts,
189
270
  truncated,
190
271
  summary,
191
272
  tsConfigPath,
192
- };
273
+ }, warnings);
193
274
  }
194
275
  buildSummary(result, projectRoot, watch, method) {
195
276
  if (result.roots.length === 0) {
@@ -24,12 +24,13 @@
24
24
  * // projectRoot: '/project', direction: 'down', depth: 4 }
25
25
  * ```
26
26
  */
27
- import { type MCPTool } from '../types.js';
27
+ import { type MCPTool, type ToolAnnotations } from '../types.js';
28
28
  import { type CallGraphResult } from '@angular-modernizer/api';
29
29
  import { ProjectCache } from './helpers/project-cache.js';
30
30
  /** Tool output: the call graph (trees omitted with `summaryOnly`) plus a text summary. */
31
31
  export type GetCallGraphOutput = Omit<CallGraphResult, 'callers' | 'callees'> & Partial<Pick<CallGraphResult, 'callers' | 'callees'>> & {
32
32
  summary: string;
33
+ warnings?: string[];
33
34
  };
34
35
  /**
35
36
  * MCP tool that builds a call graph for a named method or function.
@@ -37,10 +38,13 @@ export type GetCallGraphOutput = Omit<CallGraphResult, 'callers' | 'callees'> &
37
38
  export declare class GetCallGraphTool implements MCPTool {
38
39
  private readonly projects;
39
40
  readonly name = "get-call-graph";
41
+ readonly title = "Get Call Graph";
42
+ readonly annotations: ToolAnnotations;
40
43
  constructor(projects?: ProjectCache);
41
44
  readonly description: string;
42
45
  readonly inputSchema: {
43
46
  type: string;
47
+ additionalProperties: boolean;
44
48
  properties: {
45
49
  method: {
46
50
  type: string;
@@ -83,8 +87,114 @@ export declare class GetCallGraphTool implements MCPTool {
83
87
  };
84
88
  required: string[];
85
89
  };
90
+ readonly outputSchema: {
91
+ type: string;
92
+ $defs: {
93
+ callNode: {
94
+ type: string;
95
+ properties: {
96
+ children: {
97
+ type: string;
98
+ items: {
99
+ $ref: string;
100
+ };
101
+ };
102
+ name: {
103
+ readonly type: "string";
104
+ };
105
+ file: {
106
+ readonly type: "string";
107
+ };
108
+ line: {
109
+ readonly type: "integer";
110
+ };
111
+ kind: {
112
+ readonly type: "string";
113
+ };
114
+ className: {
115
+ readonly type: "string";
116
+ };
117
+ snippet: {
118
+ readonly type: "string";
119
+ };
120
+ inheritedFrom: {
121
+ readonly type: "string";
122
+ };
123
+ };
124
+ required: string[];
125
+ };
126
+ };
127
+ properties: {
128
+ warnings: {
129
+ readonly type: "array";
130
+ readonly items: {
131
+ readonly type: "string";
132
+ };
133
+ readonly description: "Conditions that can make the result incomplete, e.g. library imports that do not resolve because node_modules is missing.";
134
+ };
135
+ target: {
136
+ type: string[];
137
+ properties: {
138
+ readonly name: {
139
+ readonly type: "string";
140
+ };
141
+ readonly file: {
142
+ readonly type: "string";
143
+ };
144
+ readonly line: {
145
+ readonly type: "integer";
146
+ };
147
+ readonly kind: {
148
+ readonly type: "string";
149
+ };
150
+ readonly className: {
151
+ readonly type: "string";
152
+ };
153
+ readonly snippet: {
154
+ readonly type: "string";
155
+ };
156
+ readonly inheritedFrom: {
157
+ readonly type: "string";
158
+ };
159
+ };
160
+ required: string[];
161
+ };
162
+ callers: {
163
+ type: string;
164
+ items: {
165
+ $ref: string;
166
+ };
167
+ };
168
+ callees: {
169
+ type: string;
170
+ items: {
171
+ $ref: string;
172
+ };
173
+ };
174
+ nodeCount: {
175
+ type: string;
176
+ };
177
+ truncated: {
178
+ type: string;
179
+ };
180
+ truncatedAt: {
181
+ type: string;
182
+ };
183
+ summary: {
184
+ type: string;
185
+ };
186
+ };
187
+ required: string[];
188
+ };
86
189
  execute(args: Record<string, unknown>): Promise<GetCallGraphOutput>;
87
190
  private buildSummary;
191
+ /**
192
+ * Summary lines for the direct callers or callees, at most
193
+ * {@link SUMMARY_MAX_NODES}: a wide fan-in (500 callers on a large app)
194
+ * made the summary about as large as the tree itself, and the summary is
195
+ * sent as text next to `structuredContent`.
196
+ */
197
+ private listNodes;
88
198
  private label;
89
199
  }
90
200
  //# sourceMappingURL=get-call-graph.d.ts.map
@@ -28,12 +28,31 @@ import { CallGraphBuilder, } from '@angular-modernizer/api';
28
28
  import { existsSync } from 'node:fs';
29
29
  import { findTsConfig } from './helpers/find-ts-config.js';
30
30
  import { ProjectCache } from './helpers/project-cache.js';
31
+ import { WARNINGS_OUTPUT_SCHEMA, withWarnings, } from './helpers/output-contract.js';
32
+ /** Direct callers and callees spelled out per list in the summary. */
33
+ const SUMMARY_MAX_NODES = 50;
34
+ const CALL_NODE_FIELDS = {
35
+ name: { type: 'string' },
36
+ file: { type: 'string' },
37
+ line: { type: 'integer' },
38
+ kind: { type: 'string' },
39
+ className: { type: 'string' },
40
+ snippet: { type: 'string' },
41
+ inheritedFrom: { type: 'string' },
42
+ };
31
43
  /**
32
44
  * MCP tool that builds a call graph for a named method or function.
33
45
  */
34
46
  export class GetCallGraphTool {
35
47
  projects;
36
48
  name = 'get-call-graph';
49
+ title = 'Get Call Graph';
50
+ annotations = {
51
+ readOnlyHint: true,
52
+ destructiveHint: false,
53
+ idempotentHint: true,
54
+ openWorldHint: false,
55
+ };
37
56
  constructor(projects = new ProjectCache()) {
38
57
  this.projects = projects;
39
58
  }
@@ -48,11 +67,13 @@ export class GetCallGraphTool {
48
67
  'Callees are resolved via the type checker and include new X() (constructor incl. field initializers), ' +
49
68
  'super(), and property reads that resolve to getters. ' +
50
69
  'Callers of component members include calls from the component template as leaf nodes ' +
51
- '(kind "template", template file and line, snippet). ' +
70
+ '(kind "template", template file and line, snippet), also from templates of subclasses that inherit the member ' +
71
+ '(className of the subclass, inheritedFrom of the declaring class; a subclass overriding it is left out). ' +
52
72
  'Use method "ClassName.constructor" to see what runs transitively during construction. ' +
53
73
  'Use after parse-stack-trace to trace error propagation through the call hierarchy.';
54
74
  inputSchema = {
55
75
  type: 'object',
76
+ additionalProperties: false,
56
77
  properties: {
57
78
  method: {
58
79
  type: 'string',
@@ -98,6 +119,34 @@ export class GetCallGraphTool {
98
119
  },
99
120
  required: ['method', 'file', 'projectRoot'],
100
121
  };
122
+ outputSchema = {
123
+ type: 'object',
124
+ $defs: {
125
+ callNode: {
126
+ type: 'object',
127
+ properties: {
128
+ ...CALL_NODE_FIELDS,
129
+ children: { type: 'array', items: { $ref: '#/$defs/callNode' } },
130
+ },
131
+ required: ['name', 'file', 'line', 'children'],
132
+ },
133
+ },
134
+ properties: {
135
+ target: {
136
+ type: ['object', 'null'],
137
+ properties: CALL_NODE_FIELDS,
138
+ required: ['name', 'file', 'line'],
139
+ },
140
+ callers: { type: 'array', items: { $ref: '#/$defs/callNode' } },
141
+ callees: { type: 'array', items: { $ref: '#/$defs/callNode' } },
142
+ nodeCount: { type: 'integer' },
143
+ truncated: { type: 'boolean' },
144
+ truncatedAt: { type: 'integer' },
145
+ summary: { type: 'string' },
146
+ ...WARNINGS_OUTPUT_SCHEMA,
147
+ },
148
+ required: ['target', 'nodeCount', 'truncated', 'summary'],
149
+ };
101
150
  async execute(args) {
102
151
  const params = args;
103
152
  if (!params.method) {
@@ -121,6 +170,7 @@ export class GetCallGraphTool {
121
170
  throw new Error('maxNodes must be a positive integer');
122
171
  }
123
172
  const graphBuilder = new CallGraphBuilder(this.projects.get(tsConfigPath));
173
+ const warnings = this.projects.warnings(tsConfigPath);
124
174
  const options = {
125
175
  direction: params.direction ?? 'both',
126
176
  depth: params.depth ?? 2,
@@ -131,9 +181,9 @@ export class GetCallGraphTool {
131
181
  const summary = this.buildSummary(params.method, result);
132
182
  if (params.summaryOnly) {
133
183
  const { callers: _callers, callees: _callees, ...rest } = result;
134
- return { ...rest, summary };
184
+ return withWarnings({ ...rest, summary }, warnings);
135
185
  }
136
- return { ...result, summary };
186
+ return withWarnings({ ...result, summary }, warnings);
137
187
  }
138
188
  buildSummary(method, result) {
139
189
  if (!result.target) {
@@ -150,27 +200,39 @@ export class GetCallGraphTool {
150
200
  }
151
201
  if (result.callers.length > 0) {
152
202
  lines.push(`\nCallers (${result.callers.length}):`);
153
- for (const c of result.callers) {
154
- lines.push(` ← ${this.label(c)} (${c.file}:${c.line})`);
155
- }
203
+ lines.push(...this.listNodes(result.callers, '←', 'callers'));
156
204
  }
157
205
  else {
158
206
  lines.push('\nNo callers found (root method or not traced).');
159
207
  }
160
208
  if (result.callees.length > 0) {
161
209
  lines.push(`\nCallees (${result.callees.length}):`);
162
- for (const c of result.callees) {
163
- lines.push(` → ${this.label(c)} (${c.file}:${c.line})`);
164
- }
210
+ lines.push(...this.listNodes(result.callees, '→', 'callees'));
165
211
  }
166
212
  else {
167
213
  lines.push('\nNo callees found (leaf method or not traced).');
168
214
  }
169
215
  return lines.join('\n');
170
216
  }
217
+ /**
218
+ * Summary lines for the direct callers or callees, at most
219
+ * {@link SUMMARY_MAX_NODES}: a wide fan-in (500 callers on a large app)
220
+ * made the summary about as large as the tree itself, and the summary is
221
+ * sent as text next to `structuredContent`.
222
+ */
223
+ listNodes(nodes, arrow, field) {
224
+ const lines = nodes
225
+ .slice(0, SUMMARY_MAX_NODES)
226
+ .map((c) => ` ${arrow} ${this.label(c)} (${c.file}:${c.line})`);
227
+ if (nodes.length > SUMMARY_MAX_NODES) {
228
+ lines.push(` ... and ${nodes.length - SUMMARY_MAX_NODES} more in ${field}`);
229
+ }
230
+ return lines;
231
+ }
171
232
  label(node) {
172
233
  if (node.kind === 'template') {
173
- return `template of ${node.className ?? 'component'}: ${node.snippet ?? ''}`;
234
+ const inherited = node.inheritedFrom === undefined ? '' : ` (inherits ${node.inheritedFrom})`;
235
+ return `template of ${node.className ?? 'component'}${inherited}: ${node.snippet ?? ''}`;
174
236
  }
175
237
  const qualified = node.className
176
238
  ? `${node.className}.${node.name}`