Skip to main content
Glama
KonMam

s3-mcp

by KonMam

get_object

Retrieve an object from an S3 bucket by specifying the bucket name and object key. Returns the S3 response in JSON format.

Instructions

Gets an object from an S3 bucket.

Args: bucket (str): The name of the bucket. key (str): The key (name) of the object.

Returns: str: JSON formatted S3 response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucketYes
keyYes

Implementation Reference

  • src/s3_mcp.py:164-164 (registration)
    Registration of the get_object tool using @mcp.tool() decorator.
    @mcp.tool()
  • Handler function that executes the tool logic by calling the helper and formatting the response as JSON.
    def get_object(bucket: str, key: str) -> str: """Gets an object from an S3 bucket. Args: bucket (str): The name of the bucket. key (str): The key (name) of the object. Returns: str: JSON formatted S3 response. """ result = _get_object_logic(bucket=bucket, key=key) return format_response(result)
  • Input schema defined by function parameters and docstring (bucket: str, key: str), output str (JSON).
    def get_object(bucket: str, key: str) -> str: """Gets an object from an S3 bucket. Args: bucket (str): The name of the bucket. key (str): The key (name) of the object. Returns: str: JSON formatted S3 response. """
  • Helper function implementing the core S3 get_object logic using boto3 client.
    def _get_object_logic(bucket: str, key: str) -> Dict[str, Any]: """Core logic to get an object from an S3 bucket. Args: bucket (str): The S3 bucket name. key (str): The S3 object key. Returns: Dict[str, Any]: Raw boto3 response from get_object. """ client = get_s3_client() response = client.get_object(Bucket=bucket, Key=key) # The body is a StreamingBody, which is not directly JSON serializable. # We read it and decode it to a string. if 'Body' in response: response['Body'] = response['Body'].read().decode('utf-8') return response

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