Skip to main content
Glama
KonMam

s3-mcp

by KonMam

copy_object

Copy files between S3 buckets or within the same bucket by specifying source and destination locations.

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
source_bucketYes
source_keyYes
destination_bucketYes
destination_keyYes

Implementation Reference

  • Main handler function for the 'copy_object' tool, decorated with @mcp.tool() for registration. Defines input schema via type hints and docstring, executes the tool by calling helper and formatting response.
    @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)
  • Helper function containing the core S3 copy_object logic using boto3 client.
    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, )

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