s3_object_read
Retrieve and read the content of an object stored in an S3 bucket by specifying the bucket name and object key using the AWS MCP Server.
Instructions
Read an object's content from S3
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket_name | Yes | Name of the S3 bucket | |
| object_key | Yes | Key/path of the object to read |
Input Schema (JSON Schema)
{
"properties": {
"bucket_name": {
"description": "Name of the S3 bucket",
"type": "string"
},
"object_key": {
"description": "Key/path of the object to read",
"type": "string"
}
},
"required": [
"bucket_name",
"object_key"
],
"type": "object"
}
Implementation Reference
- src/mcp_server_aws/server.py:168-175 (handler)Executes the s3_object_read tool by fetching the S3 object using boto3 client and returning its decoded content 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 Tool object for s3_object_read, including name, description, and input schema requiring bucket_name and object_key.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:135-139 (registration)Registers all AWS tools, including s3_object_read, by returning get_aws_tools() in response to list_tools calls.@server.list_tools() async def list_tools() -> list[Tool]: """List available AWS tools""" logger.debug("Handling list_tools request") return get_aws_tools()