Skip to main content
Glama
KonMam

s3-mcp

by KonMam

delete_objects

Remove multiple files from an S3 bucket using this tool. Specify bucket name and file keys to delete objects, with optional error suppression for failed deletions.

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler for the 'delete_objects' tool, decorated with @mcp.tool() for registration. It calls the helper logic and formats the response using format_response.
    @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)
  • Core helper function that executes the boto3 S3 client.delete_objects API call to delete multiple objects.
    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,
        )
  • src/s3_mcp.py:494-494 (registration)
    Decorator that registers the delete_objects function as an MCP tool.
    @mcp.tool()
  • Type annotations and parameters defining the input schema for the tool.
    def delete_objects(
        bucket: str,
        keys: List[str],
        quiet: bool = False,
    ) -> str:
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions that 'quiet' suppresses errors and returns only failed deletions, which is useful, but doesn't cover critical aspects like irreversible deletion, required permissions, rate limits, or response format details. For a destructive operation, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear opening sentence followed by Args and Returns sections. It's front-loaded and avoids redundancy, though the 'Args' and 'Returns' labels are slightly verbose. Overall, it's efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a destructive tool with 3 parameters (0% schema coverage), no annotations, but an output schema, the description is moderately complete. It covers the basic purpose and some parameter behavior, but lacks safety warnings, permission requirements, and detailed usage context. The output schema helps, but key operational details are missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains 'quiet' parameter behavior clearly, adding value beyond the schema. However, it doesn't clarify 'bucket' (e.g., naming conventions) or 'keys' (e.g., format, wildcards), leaving gaps. The partial compensation justifies a baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Deletes multiple objects') and resource ('from an S3 bucket'), making the purpose immediately understandable. It distinguishes from sibling 'delete_object' by specifying it handles multiple objects, though it doesn't explicitly contrast with other siblings like 'copy_object' or 'put_object'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., bucket existence, permissions), compare with 'delete_object' for single deletions, or advise on error handling with the 'quiet' parameter. The description lacks context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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