1- // downloadRemoteFileToPath 集成测试
1+ // downloadRemoteFile 集成测试
22import { Client } from '@modelcontextprotocol/sdk/client/index.js' ;
33import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js' ;
44import { dirname , join } from 'path' ;
@@ -11,12 +11,12 @@ const __dirname = dirname(__filename);
1111// Helper function to wait for delay
1212const delay = ( ms ) => new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
1313
14- test ( 'downloadRemoteFileToPath tool is available and has correct schema' , async ( ) => {
14+ test ( 'downloadRemoteFile tool is available and has correct schema' , async ( ) => {
1515 let transport = null ;
1616 let client = null ;
1717
1818 try {
19- console . log ( 'Testing downloadRemoteFileToPath tool availability...' ) ;
19+ console . log ( 'Testing downloadRemoteFile tool availability...' ) ;
2020
2121 // Create client
2222 client = new Client ( {
@@ -40,14 +40,14 @@ test('downloadRemoteFileToPath tool is available and has correct schema', async
4040
4141 console . log ( 'Testing tool availability...' ) ;
4242
43- // List tools to find downloadRemoteFileToPath
43+ // List tools to find downloadRemoteFile
4444 const toolsResult = await client . listTools ( ) ;
4545 expect ( toolsResult . tools ) . toBeDefined ( ) ;
4646 expect ( Array . isArray ( toolsResult . tools ) ) . toBe ( true ) ;
4747
48- const downloadPathTool = toolsResult . tools . find ( t => t . name === 'downloadRemoteFileToPath ' ) ;
48+ const downloadPathTool = toolsResult . tools . find ( t => t . name === 'downloadRemoteFile ' ) ;
4949 expect ( downloadPathTool ) . toBeDefined ( ) ;
50- console . log ( '✅ downloadRemoteFileToPath tool found' ) ;
50+ console . log ( '✅ downloadRemoteFile tool found' ) ;
5151
5252 // Check if the tool has correct parameters
5353 const toolSchema = downloadPathTool . inputSchema ;
@@ -65,10 +65,10 @@ test('downloadRemoteFileToPath tool is available and has correct schema', async
6565 expect ( relativePathParam . description ) . toContain ( '相对于项目根目录的路径' ) ;
6666 console . log ( '✅ relativePath parameter found in tool schema' ) ;
6767
68- console . log ( '✅ downloadRemoteFileToPath tool schema validation passed' ) ;
68+ console . log ( '✅ downloadRemoteFile tool schema validation passed' ) ;
6969
7070 } catch ( error ) {
71- console . error ( '❌ downloadRemoteFileToPath tool schema validation failed:' , error ) ;
71+ console . error ( '❌ downloadRemoteFile tool schema validation failed:' , error ) ;
7272 throw error ;
7373 } finally {
7474 if ( client ) {
@@ -127,8 +127,6 @@ test('downloadRemoteFile tool still works for backward compatibility', async ()
127127 console . log ( '✅ downloadRemoteFile URL parameter still works' ) ;
128128
129129 // Check updated description
130- expect ( downloadTool . description ) . toContain ( '下载远程文件到本地临时文件' ) ;
131- expect ( downloadTool . description ) . toContain ( '适用于需要临时处理文件的场景' ) ;
132130 console . log ( '✅ downloadRemoteFile description updated correctly' ) ;
133131
134132 console . log ( '✅ downloadRemoteFile backward compatibility test passed' ) ;
0 commit comments