Skip to main content
Glama
KonMam

s3-mcp

by KonMam

copy_object

Transfer objects between S3 buckets by specifying source and destination locations. Retrieve a JSON response confirming the operation's success.

Instructions

Copies an object from one S3 location to another.

Args: source_bucket (str): The name of the source bucket. source_key (str): The key of the source object. destination_bucket (str): The name of the destination bucket. destination_key (str): The key of the destination object.

Returns: str: JSON formatted S3 response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
destination_bucketYes
destination_keyYes
source_bucketYes
source_keyYes

Implementation Reference

  • The main handler function for the "copy_object" MCP tool. It is decorated with @mcp.tool(), which registers it, defines the input schema via type hints and docstring, and delegates to the core logic helper.
    @mcp.tool() def copy_object( source_bucket: str, source_key: str, destination_bucket: str, destination_key: str, ) -> str: """Copies an object from one S3 location to another. Args: source_bucket (str): The name of the source bucket. source_key (str): The key of the source object. destination_bucket (str): The name of the destination bucket. destination_key (str): The key of the destination object. Returns: str: JSON formatted S3 response. """ result = _copy_object_logic( source_bucket=source_bucket, source_key=source_key, destination_bucket=destination_bucket, destination_key=destination_key, ) return format_response(result)
  • Supporting helper function that implements the core S3 object copy operation using the boto3 client's copy_object method.
    def _copy_object_logic( source_bucket: str, source_key: str, destination_bucket: str, destination_key: str, ) -> Dict[str, Any]: """Core logic to copy an object from one S3 location to another. Args: source_bucket (str): The name of the source bucket. source_key (str): The key of the source object. destination_bucket (str): The name of the destination bucket. destination_key (str): The key of the destination object. Returns: Dict[str, Any]: Raw boto3 response from copy_object. """ client = get_s3_client() copy_source = {'Bucket': source_bucket, 'Key': source_key} return client.copy_object( CopySource=copy_source, Bucket=destination_bucket, Key=destination_key, )

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