s3_object_read
Retrieve content from Amazon S3 storage by specifying bucket name and object key to access stored files or data.
Instructions
Read an object's content from S3
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket_name | Yes | Name of the S3 bucket | |
| object_key | Yes | Key/path of the object to read |
Implementation Reference
- src/mcp_server_aws/server.py:168-175 (handler)The core handler logic for the 's3_object_read' tool: retrieves the S3 object using boto3 get_object, reads and decodes its body to UTF-8 text, and returns it as TextContent.elif name == "s3_object_read": logging.info(f"Reading object: {arguments['object_key']}") response = s3_client.get_object( Bucket=arguments["bucket_name"], Key=arguments["object_key"] ) content = response['Body'].read().decode('utf-8') return [TextContent(type="text", text=content)]
- src/mcp_server_aws/tools.py:96-113 (schema)Defines the input schema and metadata for the 's3_object_read' tool using MCP Tool object.Tool( name="s3_object_read", description="Read an object's content from S3", inputSchema={ "type": "object", "properties": { "bucket_name": { "type": "string", "description": "Name of the S3 bucket" }, "object_key": { "type": "string", "description": "Key/path of the object to read" } }, "required": ["bucket_name", "object_key"] } ),
- src/mcp_server_aws/server.py:136-140 (registration)Registers the 's3_object_read' tool (among others) with the MCP server by providing it in the list_tools() response via get_aws_tools().async def list_tools() -> list[Tool]: """List available AWS tools""" logger.debug("Handling list_tools request") return get_aws_tools()