delete_object
Remove objects from Tencent Cloud Object Storage using the object key to manage cloud storage and free up space.
Instructions
删除COS中的对象
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| object_key | Yes | 要删除的对象键名 |
Implementation Reference
- src/cosService.js:745-760 (handler)Core implementation of the delete_object tool logic, performing the actual deletion using the Tencent COS SDK.async deleteObject(key) { this._checkConfig(); try { const params = { Bucket: this.config.Bucket, Region: this.config.Region, Key: key }; await this.cos.deleteObject(params); return { success: true, key }; } catch (error) { throw new Error(`删除文件失败: ${error.message}`); } }
- index.js:228-241 (schema)Input schema and tool metadata definition for delete_object.delete_object: { name: 'delete_object', description: '删除COS中的对象', inputSchema: { type: 'object', properties: { object_key: { type: 'string', description: '要删除的对象键名' } }, required: ['object_key'] } },
- index.js:548-557 (handler)MCP CallToolRequestSchema handler dispatch for delete_object tool.case 'delete_object': const deleteResult = await cosService.deleteObject(args.object_key); return { content: [ { type: 'text', text: JSON.stringify({ success: true, data: deleteResult }, null, 2) } ] };
- index.js:393-395 (registration)Registration of all tools (including delete_object) via ListToolsRequestSchema handler.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: Object.values(tools), }));