Skip to main content
Glama
r3-yamauchi

Amazon Bedrock Knowledge Base MCP Server

by r3-yamauchi

create_s3_bucket

Create an S3 bucket for storing Amazon Bedrock Knowledge Base data with automatic public access blocking and configurable region selection.

Instructions

S3バケットを新規作成します。

バケット名は以下のルールに従う必要があります:

  • 3文字以上63文字以下

  • 小文字、数字、ハイフン(-)、ピリオド(.)のみ使用可能

  • 先頭と末尾は小文字または数字である必要がある

  • 連続するハイフンやピリオドは使用不可

  • IPアドレス形式(例: 192.168.1.1)は使用不可

  • バケット名はグローバルに一意である必要があります

注意: セキュリティ上の理由から、パブリックアクセスブロックは常に有効化されます。

Args: bucket_name: 作成するS3バケット名(必須) 例: "my-documents-bucket" region: バケットを作成するリージョン(デフォルト: "us-east-1") 例: "us-east-1", "ap-northeast-1" 注意: us-east-1リージョンの場合、LocationConstraintは指定しません

Returns: S3BucketCreateResponseDict: バケット作成結果 - bucket_name: 作成されたバケット名 - region: バケットが作成されたリージョン - arn: バケットのARN(arn:aws:s3:::bucket-name形式) - status: 作成ステータス("created")

Raises: ValueError: bucket_nameが空の場合、またはバケット名が無効な形式の場合 ClientError: AWS API呼び出しが失敗した場合 例: バケット名が既に使用されている、権限がないなど

Example: # 基本的なバケット作成(デフォルトリージョン、パブリックアクセスブロック有効) create_s3_bucket("my-documents-bucket")

# 特定のリージョンにバケットを作成
create_s3_bucket("my-documents-bucket", region="ap-northeast-1")

Note: - バケットの作成には数秒かかる場合があります - バケット名が既に使用されている場合、BucketAlreadyOwnedByYouまたはBucketAlreadyExistsエラーが発生します - パブリックアクセスブロック設定は、バケット作成後に自動的に適用されます

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYes
regionNous-east-1

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
arnYes
regionYes
statusYes
bucket_nameYes

Implementation Reference

  • The MCP tool handler for 'create_s3_bucket'. It validates input and calls the bedrock_client implementation.
    @mcp.tool()  # MCPツールとして公開
    @handle_errors  # エラーハンドリングデコレータを適用
    def create_s3_bucket(
        bucket_name: str,
        region: str = "us-east-1",
    ) -> S3BucketCreateResponseDict:
        """
        S3バケットを新規作成します。
        
        バケット名は以下のルールに従う必要があります:
        - 3文字以上63文字以下
        - 小文字、数字、ハイフン(-)、ピリオド(.)のみ使用可能
        - 先頭と末尾は小文字または数字である必要がある
        - 連続するハイフンやピリオドは使用不可
        - IPアドレス形式(例: 192.168.1.1)は使用不可
        - バケット名はグローバルに一意である必要があります
        
        注意: セキュリティ上の理由から、パブリックアクセスブロックは常に有効化されます。
    
        Args:
            bucket_name: 作成するS3バケット名(必須)
                例: "my-documents-bucket"
            region: バケットを作成するリージョン(デフォルト: "us-east-1")
                例: "us-east-1", "ap-northeast-1"
                注意: us-east-1リージョンの場合、LocationConstraintは指定しません
    
        Returns:
            S3BucketCreateResponseDict: バケット作成結果
                - bucket_name: 作成されたバケット名
                - region: バケットが作成されたリージョン
                - arn: バケットのARN(arn:aws:s3:::bucket-name形式)
                - status: 作成ステータス("created")
        
        Raises:
            ValueError: bucket_nameが空の場合、またはバケット名が無効な形式の場合
            ClientError: AWS API呼び出しが失敗した場合
                例: バケット名が既に使用されている、権限がないなど
        
        Example:
            # 基本的なバケット作成(デフォルトリージョン、パブリックアクセスブロック有効)
            create_s3_bucket("my-documents-bucket")
            
            # 特定のリージョンにバケットを作成
            create_s3_bucket("my-documents-bucket", region="ap-northeast-1")
        
        Note:
            - バケットの作成には数秒かかる場合があります
            - バケット名が既に使用されている場合、BucketAlreadyOwnedByYouまたはBucketAlreadyExistsエラーが発生します
            - パブリックアクセスブロック設定は、バケット作成後に自動的に適用されます
        """
        # 入力値のバリデーション(共通関数を使用)
        bucket_name = validate_required_string(bucket_name, "bucket_name")
        
        # バケット名の基本的なバリデーション
        # AWS S3のバケット名ルールに従う必要があります
        if len(bucket_name) < 3 or len(bucket_name) > 63:
            raise ValueError("bucket_name must be between 3 and 63 characters")
        
        # バケット名は小文字、数字、ハイフン、ピリオドのみ使用可能
        # ただし、IPアドレス形式は使用不可
        import re
        if not re.match(r'^[a-z0-9][a-z0-9.-]*[a-z0-9]$', bucket_name):
            raise ValueError(
                "bucket_name must start and end with a lowercase letter or number, "
                "and contain only lowercase letters, numbers, hyphens, and periods"
            )
        
        # 連続するハイフンやピリオドは使用不可
        if '..' in bucket_name or '--' in bucket_name:
            raise ValueError("bucket_name cannot contain consecutive periods or hyphens")
        
        # IPアドレス形式のチェック(簡易版)
        # より厳密なチェックが必要な場合は、ipaddressモジュールを使用できます
        ip_pattern = r'^(\d{1,3}\.){3}\d{1,3}$'
        if re.match(ip_pattern, bucket_name):
            raise ValueError("bucket_name cannot be in IP address format")
        
        # リージョンを正規化(前後の空白を削除、空文字列の場合はus-east-1を使用)
        region_cleaned = region.strip() if region else "us-east-1"
        
        # BedrockクライアントからS3バケットを作成
        result = bedrock_client.create_s3_bucket(
            bucket_name=bucket_name,  # 前後の空白は既に削除済み
            region=region_cleaned,  # 既定値はus-east-1
        )
        return result
  • The actual implementation of the S3 bucket creation logic in the bedrock_client module.
    def create_s3_bucket(
        self,
        bucket_name: str,
        region: str = "us-east-1",
    ) -> S3BucketCreateResponseDict:
        """
        S3バケットを新規作成します。
        
        バケット名は以下のルールに従う必要があります:
        - 3文字以上63文字以下
        - 小文字、数字、ハイフン(-)、ピリオド(.)のみ使用可能
        - 先頭と末尾は小文字または数字である必要がある
        - 連続するハイフンやピリオドは使用不可
        - IPアドレス形式(例: 192.168.1.1)は使用不可
        
        注意: セキュリティ上の理由から、パブリックアクセスブロックは常に有効化されます。
        
        Args:
            bucket_name: 作成するS3バケット名(必須)
            region: バケットを作成するリージョン(デフォルト: "us-east-1")
                    注意: us-east-1リージョンの場合、LocationConstraintは指定しません
        
        Returns:
            S3BucketCreateResponseDict: バケット作成結果
                - bucket_name: 作成されたバケット名
                - region: バケットが作成されたリージョン
                - arn: バケットのARN(arn:aws:s3:::bucket-name形式)
                - status: 作成ステータス("created")
        
        Raises:
            ClientError: AWS API呼び出しが失敗した場合
                例: バケット名が既に使用されている、権限がない、バケット名が無効など
        
        Note:
            - バケット名はグローバルに一意である必要があります
            - バケットの作成には数秒かかる場合があります
            - パブリックアクセスブロック設定は、バケット作成後に自動的に適用されます
        """
        try:
            # リージョンを使用(既定値はus-east-1)
            bucket_region = region
            
            # バケット作成パラメータを準備
            create_bucket_params = {"Bucket": bucket_name}
            
            # us-east-1以外のリージョンの場合、LocationConstraintを指定
            # us-east-1はデフォルトリージョンのため、LocationConstraintを指定するとエラーになります
            if bucket_region != "us-east-1":
                create_bucket_params["CreateBucketConfiguration"] = {
                    "LocationConstraint": bucket_region
                }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does an excellent job disclosing behavioral traits. It explains security implications (public access block always enabled), timing considerations (creation may take seconds), error conditions (bucket name conflicts, permission issues), and post-creation behavior (automatic public access block application). The only minor gap is lack of rate limit or quota information.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (description, rules, Args, Returns, Raises, Example, Note) and front-loads the core purpose. While comprehensive, some redundancy exists (bucket naming rules appear in both the main description and parameter documentation), and the Japanese/English mix slightly affects readability. Every section adds value, but could be more tightly integrated.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (creation with security implications), 0% schema coverage, and presence of an output schema, the description is exceptionally complete. It covers purpose, detailed constraints, parameters, return values (though output schema handles this), error conditions, examples, and important behavioral notes. The output schema existence means the description doesn't need to explain return structure in detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by providing rich parameter semantics. It explains bucket_name requirements with detailed naming rules, provides examples, and clarifies region behavior including special handling for us-east-1. The Args section explicitly documents both parameters with examples and important notes about default values and constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'S3バケットを新規作成します' (creates a new S3 bucket). It specifies the exact resource (S3 bucket) and action (create), and distinguishes it from sibling tools like 'upload_document_to_s3' or 'list_s3_documents' by focusing on bucket creation rather than document operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context through bucket naming rules and region defaults, but lacks explicit guidance on when to use this tool versus alternatives. It doesn't mention scenarios where other tools like 'create_data_source' or 'create_knowledge_base' might be more appropriate, or prerequisites for bucket creation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/r3-yamauchi/bedrock-kb-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server