get_signed_url
Generate temporary signed URLs for Tencent Cloud COS objects to provide secure, time-limited access to cloud storage files without exposing permanent credentials.
Instructions
获取COS对象的临时签名URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expire_time | No | URL有效期(秒),默认3600秒 | |
| object_key | Yes | COS中的对象键名 |
Implementation Reference
- index.js:193-210 (schema)Defines the input schema, name, and description for the 'get_signed_url' tool, used for MCP tool listing.get_signed_url: { name: 'get_signed_url', description: '获取COS对象的临时签名URL', inputSchema: { type: 'object', properties: { object_key: { type: 'string', description: 'COS中的对象键名' }, expire_time: { type: 'number', description: 'URL有效期(秒),默认3600秒' } }, required: ['object_key'] } },
- index.js:524-533 (handler)MCP CallToolRequestSchema handler case for 'get_signed_url': extracts arguments, calls cosService.getSignedUrl, formats and returns response.case 'get_signed_url': const urlResult = await cosService.getSignedUrl(args.object_key, args.expire_time); return { content: [ { type: 'text', text: JSON.stringify({ success: true, data: urlResult }, null, 2) } ] };
- src/cosService.js:691-708 (handler)Core implementation of getSignedUrl: validates config, generates signed URL using Tencent COS SDK's getObjectUrl with Sign: true.async getSignedUrl(key, expireTime = 3600) { this._checkConfig(); try { const params = { Bucket: this.config.Bucket, Region: this.config.Region, Key: key, Sign: true, Expires: expireTime }; const url = await this.cos.getObjectUrl(params); return { success: true, url }; } catch (error) { throw new Error(`获取签名URL失败: ${error.message}`); } }