s3_delete_object
Remove objects from S3-compatible storage buckets to manage storage space and maintain data organization.
Instructions
Delete an object from an S3 bucket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket | Yes | The name of the bucket | |
| key | Yes | The key (path) of the object |
Implementation Reference
- src/index.ts:241-259 (handler)The handler logic for the s3_delete_object tool. It extracts the bucket and key from the request arguments, creates a DeleteObjectCommand, sends it to the S3 client, and returns a success message.case "s3_delete_object": { const { bucket, key } = request.params.arguments as { bucket: string; key: string; }; const command = new DeleteObjectCommand({ Bucket: bucket, Key: key, }); await s3Client.send(command); return { content: [ { type: "text", text: `Successfully deleted ${bucket}/${key}`, }, ], }; }
- src/index.ts:133-150 (schema)The tool definition including name, description, and input schema for s3_delete_object, registered in the ListTools response.{ name: "s3_delete_object", description: "Delete an object from an S3 bucket", inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, key: { type: "string", description: "The key (path) of the object", }, }, required: ["bucket", "key"], }, },
- src/index.ts:60-153 (registration)The ListTools request handler where the s3_delete_object tool is registered by including it in the tools list.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ { name: "s3_list_buckets", description: "List all S3 buckets", inputSchema: { type: "object", properties: {}, }, }, { name: "s3_list_objects", description: "List objects in an S3 bucket", inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, prefix: { type: "string", description: "Optional prefix to filter objects", }, maxKeys: { type: "number", description: "Maximum number of keys to return (default 1000)", }, }, required: ["bucket"], }, }, { name: "s3_read_object", description: "Read the content of an object from an S3 bucket", inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, key: { type: "string", description: "The key (path) of the object", }, }, required: ["bucket", "key"], }, }, { name: "s3_put_object", description: "Upload an object to an S3 bucket", inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, key: { type: "string", description: "The key (path) of the object", }, content: { type: "string", description: "The content to upload", }, }, required: ["bucket", "key", "content"], }, }, { name: "s3_delete_object", description: "Delete an object from an S3 bucket", inputSchema: { type: "object", properties: { bucket: { type: "string", description: "The name of the bucket", }, key: { type: "string", description: "The key (path) of the object", }, }, required: ["bucket", "key"], }, }, ], }; });