Skip to main content
Glama
KonMam

s3-mcp

by KonMam

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
NameRequiredDescriptionDefault
bucketYes
keyYes

Implementation Reference

  • 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)
  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KonMam/s3-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server