delete_object
Remove objects from AWS S3 buckets to manage storage and maintain data hygiene by specifying bucket name and object key.
Instructions
Deletes an object from an S3 bucket.
Args: bucket (str): The name of the bucket. key (str): The key (name) of the object.
Returns: str: JSON formatted S3 response.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket | Yes | ||
| key | Yes |
Implementation Reference
- src/s3_mcp.py:193-205 (handler)The MCP tool handler for 'delete_object', decorated with @mcp.tool(). It invokes the core deletion logic and formats the response as JSON.@mcp.tool() def delete_object(bucket: str, key: str) -> str: """Deletes an object from an S3 bucket. Args: bucket (str): The name of the bucket. key (str): The key (name) of the object. Returns: str: JSON formatted S3 response. """ result = _delete_object_logic(bucket=bucket, key=key) return format_response(result)
- src/s3_mcp.py:179-190 (helper)Helper function containing the core logic: obtains S3 client and calls boto3 delete_object.def _delete_object_logic(bucket: str, key: str) -> Dict[str, Any]: """Core logic to delete an object from an S3 bucket. Args: bucket (str): The S3 bucket name. key (str): The S3 object key. Returns: Dict[str, Any]: Raw boto3 response from delete_object. """ client = get_s3_client() return client.delete_object(Bucket=bucket, Key=key)