|
6 | 6 | * found in the LICENSE file at https://angular.dev/license |
7 | 7 | */ |
8 | 8 |
|
9 | | -import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol'; |
10 | | -import type { ServerNotification, ServerRequest } from '@modelcontextprotocol/sdk/types'; |
| 9 | +import type { ServerContext } from '@modelcontextprotocol/server'; |
11 | 10 | import { join } from 'node:path'; |
12 | 11 | import type { SourceFile } from 'typescript'; |
13 | 12 | import { z } from 'zod'; |
@@ -57,7 +56,7 @@ change detection (a prerequisite for zoneless applications). |
57 | 56 | export async function registerZonelessMigrationTool( |
58 | 57 | fileOrDirPath: string, |
59 | 58 | host: Host, |
60 | | - extras: RequestHandlerExtra<ServerRequest, ServerNotification>, |
| 59 | + extras: ServerContext, |
61 | 60 | ) { |
62 | 61 | let filesWithComponents, componentTestFiles, zoneFiles, categorizationErrors; |
63 | 62 | try { |
@@ -114,7 +113,7 @@ export async function registerZonelessMigrationTool( |
114 | 113 | async function discoverAndCategorizeFiles( |
115 | 114 | fileOrDirPath: string, |
116 | 115 | host: Host, |
117 | | - extras: RequestHandlerExtra<ServerRequest, ServerNotification>, |
| 116 | + extras: ServerContext, |
118 | 117 | ) { |
119 | 118 | const filePaths: string[] = []; |
120 | 119 | const componentTestFiles = new Set<SourceFile>(); |
@@ -175,7 +174,7 @@ async function discoverAndCategorizeFiles( |
175 | 174 | async function categorizeFile( |
176 | 175 | sourceFile: SourceFile, |
177 | 176 | host: Host, |
178 | | - extras: RequestHandlerExtra<ServerRequest, ServerNotification>, |
| 177 | + extras: ServerContext, |
179 | 178 | categorizedFiles: { |
180 | 179 | filesWithComponents: Set<SourceFile>; |
181 | 180 | componentTestFiles: Set<SourceFile>; |
@@ -216,11 +215,11 @@ async function categorizeFile( |
216 | 215 | } |
217 | 216 |
|
218 | 217 | async function rankComponentFilesForMigration( |
219 | | - { sendRequest }: RequestHandlerExtra<ServerRequest, ServerNotification>, |
| 218 | + ctx: ServerContext, |
220 | 219 | componentFiles: SourceFile[], |
221 | 220 | ): Promise<SourceFile[]> { |
222 | 221 | try { |
223 | | - const response = await sendRequest( |
| 222 | + const response = await ctx.mcpReq.send( |
224 | 223 | { |
225 | 224 | method: 'sampling/createMessage', |
226 | 225 | params: { |
|
0 commit comments