Skip to main content
Glama
KonMam

s3-mcp

by KonMam

upload_file

Upload a file to a specified S3 bucket and key using the s3-mcp server. Input the file path, bucket name, and key to receive a JSON success message upon completion.

Instructions

Uploads a file to an S3 object.

Args: filename (str): The path to the file to upload. bucket (str): The name of the bucket to upload to. key (str): The name of the key to upload to.

Returns: str: JSON formatted success message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYes
filenameYes
keyYes

Implementation Reference

  • The main handler function for the 'upload_file' MCP tool, decorated with @mcp.tool() to register it. It processes inputs and calls the core upload logic.
    @mcp.tool() def upload_file( filename: str, bucket: str, key: str, ) -> str: """Uploads a file to an S3 object. Args: filename (str): The path to the file to upload. bucket (str): The name of the bucket to upload to. key (str): The name of the key to upload to. Returns: str: JSON formatted success message. """ _upload_file_logic(filename=filename, bucket=bucket, key=key) return format_response( {"status": "success", "message": f"File '{filename}' uploaded to '{bucket}/{key}'."} )
  • The core helper function implementing the S3 file upload using boto3 client.upload_file.
    def _upload_file_logic( filename: str, bucket: str, key: str, extra_args: Optional[Dict[str, Any]] = None, ) -> None: """Core logic to upload a file to an S3 bucket. Args: filename (str): The path to the file to upload. bucket (str): The S3 bucket name. key (str): The S3 object key. extra_args (Optional[Dict[str, Any]]): Extra arguments for the upload. """ client = get_s3_client() client.upload_file( Filename=filename, Bucket=bucket, Key=key, ExtraArgs=extra_args, )

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