Skip to main content
Glama
KonMam

s3-mcp

by KonMam

delete_objects

Remove multiple objects from an S3 bucket by specifying bucket name and object keys. Optionally suppress errors to return only failed deletions. Returns JSON-formatted S3 response.

Instructions

Deletes multiple objects from an S3 bucket.

Args: bucket (str): The name of the bucket. keys (List[str]): A list of keys to delete. quiet (bool): Suppress errors and return only failed deletions.

Returns: str: JSON formatted S3 response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYes
keysYes
quietNo

Implementation Reference

  • The main handler function for the 'delete_objects' tool, registered via @mcp.tool(). It invokes the core logic helper and formats the boto3 response as JSON.
    @mcp.tool() def delete_objects( bucket: str, keys: List[str], quiet: bool = False, ) -> str: """Deletes multiple objects from an S3 bucket. Args: bucket (str): The name of the bucket. keys (List[str]): A list of keys to delete. quiet (bool): Suppress errors and return only failed deletions. Returns: str: JSON formatted S3 response. """ result = _delete_objects_logic( bucket=bucket, keys=keys, quiet=quiet, ) return format_response(result)
  • Helper function containing the core implementation of deleting multiple S3 objects using boto3's delete_objects method.
    def _delete_objects_logic( bucket: str, keys: List[str], quiet: bool = False, ) -> Dict[str, Any]: """Core logic to delete multiple objects from an S3 bucket. Args: bucket (str): The S3 bucket name. keys (List[str]): A list of keys to delete. quiet (bool): Whether to suppress errors and return only failed deletions. Returns: Dict[str, Any]: Raw boto3 response from delete_objects. """ client = get_s3_client() objects_to_delete = [{'Key': key} for key in keys] delete_payload = {'Objects': objects_to_delete, 'Quiet': quiet} return client.delete_objects( Bucket=bucket, Delete=delete_payload, )

Other Tools

Related Tools

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