@@ -5,6 +5,7 @@ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"
5
5
6
6
import { MCP_SERVER_CLI_SCRIPT } from "./constants.js" ;
7
7
import { LLMToolCall } from "./accuracy-result-storage/result-storage.js" ;
8
+ import { VercelMCPClient , VercelMCPClientTools } from "./agent.js" ;
8
9
9
10
type ToolResultGeneratorFn = ( ...parameters : unknown [ ] ) => CallToolResult | Promise < CallToolResult > ;
10
11
export type MockedTools = Record < string , ToolResultGeneratorFn > ;
@@ -22,15 +23,15 @@ export class AccuracyTestingClient {
22
23
private mockedTools : MockedTools = { } ;
23
24
private llmToolCalls : LLMToolCall [ ] = [ ] ;
24
25
25
- private constructor ( private readonly vercelMCPClient : Awaited < ReturnType < typeof createMCPClient > > ) { }
26
+ private constructor ( private readonly vercelMCPClient : VercelMCPClient ) { }
26
27
27
- async close ( ) {
28
+ async close ( ) : Promise < void > {
28
29
await this . vercelMCPClient ?. close ( ) ;
29
30
}
30
31
31
- async vercelTools ( ) {
32
+ async vercelTools ( ) : Promise < VercelMCPClientTools > {
32
33
const vercelTools = ( await this . vercelMCPClient ?. tools ( ) ) ?? { } ;
33
- const rewrappedVercelTools : typeof vercelTools = { } ;
34
+ const rewrappedVercelTools : VercelMCPClientTools = { } ;
34
35
for ( const [ toolName , tool ] of Object . entries ( vercelTools ) ) {
35
36
rewrappedVercelTools [ toolName ] = createVercelTool ( {
36
37
...tool ,
@@ -65,20 +66,20 @@ export class AccuracyTestingClient {
65
66
return rewrappedVercelTools ;
66
67
}
67
68
68
- getLLMToolCalls ( ) {
69
+ getLLMToolCalls ( ) : LLMToolCall [ ] {
69
70
return this . llmToolCalls ;
70
71
}
71
72
72
- mockTools ( mockedTools : MockedTools ) {
73
+ mockTools ( mockedTools : MockedTools ) : void {
73
74
this . mockedTools = mockedTools ;
74
75
}
75
76
76
- resetForTests ( ) {
77
+ resetForTests ( ) : void {
77
78
this . mockTools ( { } ) ;
78
79
this . llmToolCalls = [ ] ;
79
80
}
80
81
81
- static async initializeClient ( mdbConnectionString : string ) {
82
+ static async initializeClient ( mdbConnectionString : string ) : Promise < AccuracyTestingClient > {
82
83
const clientTransport = new StdioClientTransport ( {
83
84
command : process . execPath ,
84
85
args : [ MCP_SERVER_CLI_SCRIPT , "--connectionString" , mdbConnectionString ] ,
0 commit comments