@@ -2,7 +2,6 @@ import { describe, it, expect, vi, beforeEach } from "vitest";
22import mcpTool from "../../../../src/agent/tools/definitions/mcp" ;
33import { Client } from "@modelcontextprotocol/sdk/client/index.js" ;
44import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js" ;
5- import { ToolError } from "../../../../src/agent/errors" ;
65import type { Config } from "../../../../src/config" ;
76
87vi . mock ( "@modelcontextprotocol/sdk/client/index.js" ) ;
@@ -12,9 +11,9 @@ describe("mcp tool", () => {
1211 const mockClient = vi . mocked ( Client ) ;
1312 const mockTransport = vi . mocked ( StdioClientTransport ) ;
1413
15- let mockConnect : any ;
16- let mockCallTool : any ;
17- let mockClose : any ;
14+ let mockConnect : vi . Mock ;
15+ let mockCallTool : vi . Mock ;
16+ let mockClose : vi . Mock ;
1817
1918 beforeEach ( ( ) => {
2019 vi . resetAllMocks ( ) ;
@@ -29,23 +28,23 @@ describe("mcp tool", () => {
2928 ( {
3029 connect : mockConnect ,
3130 callTool : mockCallTool ,
32- } ) as any ,
31+ } ) as unknown as Client ,
3332 ) ;
3433 mockTransport . mockImplementation (
3534 ( ) =>
3635 ( {
3736 close : mockClose ,
38- } ) as any ,
37+ } ) as unknown as StdioClientTransport ,
3938 ) ;
4039 } ) ;
4140
42- const mockConfig : Config = {
41+ const mockConfig = {
4342 mcpServers : {
4443 testServer : {
4544 command : "test-command" ,
4645 } ,
4746 } ,
48- } as any ;
47+ } as unknown as Config ;
4948
5049 it ( "should call an MCP tool and return the text content" , async ( ) => {
5150 mockCallTool . mockResolvedValue ( {
@@ -143,7 +142,7 @@ describe("mcp tool", () => {
143142 args : [ "--arg1" , "--arg2" ] ,
144143 } ,
145144 } ,
146- } as any ;
145+ } as unknown as Config ;
147146
148147 const { implementation } = mcpTool ;
149148 await implementation ( { server : "testServer" , tool : "testTool" } , configWithArgs ) ;
0 commit comments