AWS、Bedrock と MCP で視覚知能を構築
AWS は、Computer Vision、Strands Agents、および Model Context Protocol (MCP) を統合し、視覚情報の取得から意思決定、行動までの一貫したパイプラインを構築する新アプローチを発表しました。
キーポイント
3 つの技術の統合による課題解決
従来の「見る」「考える」「動く」システムの断絶を解消するため、Computer Vision、Strands Agents、MCP を統合し、統一されたフレームワーク内で協調動作を実現します。
標準化されたインターフェースの確立
複雑な API 連携やカスタム実装に代わり、MCP サーバーを通じて視覚情報を処理・判断する単一の標準化されたインターフェースを提供し、開発効率を大幅に向上させます。
AWS サービスを活用した統合アーキテクチャ
IAM による一元管理の下、S3、OpenSearch、Bedrock、Rekognition を連携させることで、セキュリティと機能性を両立した堅牢なシステム構成を提案しています。
単一エージェントの役割定義とツール活用
画像・動画解析、切り抜き、背景除去などのタスクを単一の CV エージェントが担当し、利用可能なツールを直接実行して処理します。
効率的な結果表示とワークフロー最適化
複数の結果がある場合は個別に表示せず `ui_show_images` を使用してレイアウトを改善し、論理的な順序でツールを実行して視覚的結果を提供します。
統合されたビジョン MCP サーバー構成
CV サーバーと OpenSearch サーバーの 2 つのサーバーで構成され、Amazon Bedrock、Nova、Rekognition などの AI サービスを標準化されたプロトコルに統合し、AI エージェントが画像・ビデオ分析を一貫した API で実行できるようにしています。
多様な画像・動画処理ツールの提供
describe_image(Claude による詳細解析)、analyze_video(Nova による動画解析)、detect_labels(Rekognition によるラベル検出)、crop_bounding_box、remove_background など、用途に応じた複数のツールを MCP サーバー内で利用可能です。
重要な引用
The integration of AI into real-world applications has long been hindered by a fundamental challenge: the disconnect between systems that can see, systems that can think, and systems that can act.
We are converging the three key technologies: Computer Vision, Strands Agents, and the Model Context Protocol (MCP).
This integration reduces the traditional barriers between perception, decision-making, and action, letting AI systems operate more like human intelligence.
Always report back error messages exactly as received.
Use ui_show_images for multiple results (creates better layouts)
The AWS Computer Vision MCP server provides a unified interface for image and video analysis by consolidating three Amazon AI services into a standardized protocol.
影響分析・編集コメントを表示
影響分析
この発表は、AI エージェントの実装において長年存在した「モダリティ間の断絶」という根本的な課題に対する具体的な解決策を示すものであり、業界標準である MCP の採用により、マルチモーダル AI アプリケーションの開発スピードと信頼性が飛躍的に向上する可能性があります。AWS 独自のセキュリティ基盤と組み合わせることで、エンタープライズレベルでの実装障壁を下げ、視覚知能を持つ自律型システムの普及を加速させる重要な転換点となります。
編集コメント
「見る」「考える」「動く」の断絶を解消する MCP の活用は、実世界での AI エージェント運用において極めて重要なステップです。AWS が自社の強みであるセキュリティ基盤と組み合わせて提案している点は、企業導入における信頼性確保という観点で高く評価できます。
AI の実世界への導入は、長年「見えるシステム」「考えるシステム」「動くシステム」の間に存在する根本的な断絶によって阻まれてきました。開発者は複雑な統合作業や複数の API 管理、そしてこれらの隙間を埋めるための独自ソリューション作成に苦慮し、その結果、非効率でコストが高く、かつ脆い実装が生まれていました。
今回私たちは、Computer Vision(コンピュータビジョン)、Strands Agents、そして Model Context Protocol (MCP) という 3 つの主要技術を統合しました。これらを組み合わせることで、視覚情報の取得・理解・実行を一つの統一されたフレームワーク内で行えるパイプラインが構築されます。この統合により、従来の「知覚」「意思決定」「行動」の間にある障壁を取り払い、AI システムが人間のように協調して見て、理解し、反応することを可能にします。
本記事では、このアプローチを示す「Computer Vision MCP Server」について解説します。これは、AI システムが単一の標準化されたインターフェースを通じて視覚情報を処理し、賢明な意思決定を下す方法を具体化したものです。この技術の融合は、かつて複雑だった統合課題を簡素なプロセスへと変え、より広範なアプリケーションや開発者にとって AI の能力を利用可能にします。
ソリューションの概要
本アーキテクチャでは、クライアントは単一の AWS Identity and Access Management (IAM) ロールを介して複数の Amazon Web Services (AWS) と連携します。この IAM ロールがセキュリティゲートウェイとして機能し、権限管理の中心となります。
データオブジェクトの保存と管理は Amazon Simple Storage Service (Amazon S3) が担当し、インデックスされたデータの検索機能は Amazon OpenSearch が提供します。生成 AI モデルを利用できる Amazon Bedrock は、エージェントによるテキスト生成などのタスクに AI ツールへのアクセス権を与えます。また、画像分析に特化した Amazon Rekognition は、物体検出といった機能を実行します。
このアーキテクチャの最大の特徴は、統合されたセキュリティモデルにあります。IAM ロールが権限管理を一元化することで、クライアント側に認証情報を埋め込む必要がなくなり、複数の AWS サービスにわたるアクセス制御をスムーズに行えるようになります。

コンピュータビジョン、Strands Agents、MCP サーバー
本ソリューションは、主に 3 つの技術を活用しています。まず「コンピュータビジョン」は、写真や動画といった視覚情報を処理する分野です。次に「Strands Agents」は、AI エージェントを構築するためのフレームワークで、複数のモデルプロバイダーとデプロイ先に対応しています。生産環境での運用に必要な観測性(オバザビリティ)、トレーシング、スケーラブルな展開機能を備えたカスタマイズ可能なエージェントループを提供します。最後に「Model Context Protocol (MCP)」は、AI システムがツールやデータソースと統合されるプロセスを簡素化するために設計された標準規格です。これにより、各 AI モデルとデータソースの組み合わせごとに個別に接続を構築する必要がなくなります。
ユーザーインターフェース(MCP クライアント)

このインターフェースは、Streamlit を活用したチャット UI です。画面左側にはメニューパネルがあり、ユーザーは分析に使用する基盤モデルを選択できます。デフォルトでは推論機能を備えた Claude 4 Sonnet が設定されていますが、Claude 4 Sonnet と Claude 3.7 Sonnet の両方から選べるようになっています。また、サイドバーにある専用ボタンで会話履歴をリセットすることも可能です。
このアプリケーションを利用するには、画面中央にある目立つ「メディアアップロード」セクションから、画像や動画ファイルをアップロードします。システムは PNG、JPG、JPEG、GIF、WEBP などの画像形式と、MP4、AVI、MOV、MKV、WEBM、MPEG4 などの動画形式に対応しており、ファイルサイズは最大 200MB まで可能です。
ファイルのアップロード方法は、指定されたエリアにファイルをドラッグ&ドロップするか、「ファイルを選択」ボタンをクリックして端末から手動で選ぶかのどちらかです。メディアがアップロードされると、AI システムはオブジェクトの切り抜き、ラベル検出、詳細なコンテンツ分析などの各種解析タスクを実行できます。
その後、画面下部にあるメッセージ入力欄を通じてシステムと対話が可能になります。アップロードしたメディアについて具体的な質問をしたり、特定の種類の解析を依頼したりすることが可能です。
以下に、このエージェントが使用するシステムプロンプトを示します:
SYSTEM_PROMPT = """
あなたは CV ツールへの直接アクセス権を持つ専門のコンピュータビジョンエージェントです。
あなたの役割:単一エージェントの CV 専門家
- 画像・動画の分析、切り抜き、背景除去、ラベル検出を処理する
- 利用可能なツールを使ってユーザーのリクエストを直接実行する
- 視覚的な結果を伴った明確で実用的な回答を提供する
利用可能なツール:
- crop_bounding_box(image_filename, object_name) - 「切り抜かれた画像ファイル名」を返す
...
ツールの使用パターン:
切り抜きワークフロー:
1. Call crop_bounding_box("image.jpg", "person") - "cropped_person_123.jpg"
2. Call crop_bounding_box("image.jpg", "dog") - "cropped_dog_456.jpg"
3. Call ui_show_images(["cropped_person_123.jpg", "cropped_dog_456.jpg"])...
変数の受け渡し:
- 入力:アップロードされたファイル名が文脈に含まれるユーザーのクエリ
...
必ず JSON 形式で返してください。translation フィールドのみ。他のフィールドは一切追加しないこと — 余計なフィールドを書こうとして本文がトークン上限で打ち切られる事故を防ぐため:
{"translation": "リライト全文"}
効率化のルール:
- 複数の結果を表示する際は
ui_show_imagesを使用してください(レイアウトが改善されます)。
レスポンス形式:
- リクエストへの承認を行う
- 論理的な順序で適切なツールを実行する
- UI ツールを使用して結果を表示する
- 実施した内容を要約する
- 結果を表示するには、
ui_show_imagesに ["image_bg_removed_123456.png"] を渡して呼び出します。
動画分析のワークフロー例:
analyze_videoを呼び出し、動画ファイル名と具体的な監視指示を指定する- このツールは詳細な分析結果を返します
エラーメッセージが返された場合は、受け取った内容をそのまま報告してください。
"""
コンピュータビジョン MCP サーバー
実装は、CV サーバーと OpenSearch サーバーの 2 つで構成されています。それぞれ異なる種類のリクエストを処理し、その詳細は以下のセクションで説明します。
CV サーバー
AWS Computer Vision MCP サーバーは、3 つの Amazon AI サービスを標準化されたプロトコルに統合することで、画像および動画分析のための統一インターフェースを提供します。この統合により、AI エージェントは一貫した API を通じて視覚コンテンツへのアクセスと処理が可能となり、コンピュータビジョンアプリケーションの開発が効率化されます。
MCP サーバーで利用可能なツールは以下の通りです:
- describe_image ツールは、Amazon Bedrock の Claude モデルを活用し、特定の監視指示に基づいた画像分析を提供します。この機能では Amazon S3 ストレージから画像を取得し、Claude のマルチモーダル能力を通じて処理することで、AI による視覚コンテンツの解釈を支援します。画像内の記述や特定属性の識別が必要なシナリオで有用であり、分析結果とともにステータス情報も返却されます。

エージェントの応答: アップロードされた画像の説明をお手伝いします。まずコンピュータービジョンエージェントを使って分析しましょう。その後、画像とその説明を表示します。
画像の説明
アップロードされた画像は、以下の特徴を持つ田舎の屋外風景を示しています:
手前の羊は、99.07% の確信度で検出されました。
この羊は牧草地や放牧地で草を食んでいる様子です。毛色は主に灰色と白色が混ざり合っています。背景には田園地帯特有の緑豊かな野原が広がり、自然光に照らされた屋外の風景です。
画面中央に位置する羊と、その背後に広がる緑の牧草地が印象的な、穏やかな農村の風景を捉えた一枚です。画面全体を支配しているのは、背景の草原を表すさまざまな濃淡の緑と、手前の羊の灰色や白色のトーンです。
これは家畜が自然な放牧環境で草を食む様子を写した自然写真です。
次に示す「describe_image」ツールのコードスニペットは、ツールの全体的な構造を示しています。
必ず JSON 形式で返してください。translation フィールドのみ。他のフィールドは一切追加しないこと — 余計なフィールドを書こうとして本文がトークン上限で打ち切られる事故を防ぐため:
{"translation": "リライト全文"}
async def describe_image(image_file_name: str, monitoring_instructions: str) ...
try:
# S3 から画像を取得
prefix = f"mcp/{image_file_name}"
print(f"\n[DEBUG] s3://{Connections.agent_bucket_name}/{prefix} の画像解析を試みます...\n")
response = Connections.s3_client.get_object(
Bucket=Connections.agent_bucket_name,
Key=prefix
)
image_data = response['Body'].read()
content_type = response['ContentType']
# Bedrock が対応するコンテンツタイプか確認
valid_content_types = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']
if content_type not in valid_content_types:
# ファイル拡張子から推測
if image_file_name.lower().endswith(('.jpg', '.jpeg')):
content_type = 'image/jpeg'
elif image_file_name.lower().endswith('.png'):
content_type = 'image/png'
elif image_file_name.lower().endswith('.gif'):
content_type = 'image/gif'
elif image_file_name.lower().endswith('.webp'):
content_type = 'image/webp'
else:
content_type = 'image/jpeg' # デフォルト値
print(f"[DEBUG] コンテンツタイプを {content_type} に修正しました")
# Claude 用のプロンプト作成
prompt = create_multimodal_prompt(
image_data=image_data,
text=monitoring_instructions,
content_type=content_type,
system_prompt=(
"画像解析を行うアシスタントです。ユーザーの指示に基づき、詳細かつ正確な記述を提供してください。"
)
)
# Claude による解析実行
analysis = invoke_bedrock_model(prompt)
return ImageAnalysisResponse(
status="success",
source=prefix,
analysis=analysis,
message="画像解析が正常に完了しました"
)
except Exception as e:
logger.error(f"画像解析エラー: {str(e)}")
return ImageAnalysisResponse(
status="error",
source=image_file_name,
analysis=None,
message=f"画像解析エラー: {str(e)}"
)
「analyze_video」ツールは、Amazon Nova の動画分析機能を活用してコンテンツを処理します。この関数は S3 に保存された動画ファイルを扱い、具体的な指示に基づいて分析を行うことができます。
アップロードされた動画:

ユーザー: アップロードされた動画を分析してください
エージェントの回答: 動画の分析をお手伝いします。まずはコンピュータビジョンの専門家にタスクを委譲します。
アップロードされた動画(15dc6b31_19642406-uhd_3840_2160_30fps.mp4)を分析した結果、以下のことが分かりました。
コンテンツの概要
- 雪に覆われた植物(おそらく草の一種)のクローズアップ映像です
- 晴れた冬の日と見られる野外で撮影されています
- 背景は意図的にぼかされており、被写界深度の効果によって視線が主役である植物へと誘導されています
視覚的な特徴
- 白い雪と植物の自然な緑色との対比が際立っています
- 雪は細長い葉の上に不均一に積もっています
- 雪がわずかに溶け始めているように見え、気温がやや高いことを示唆しています
「detect_labels」ツールは Amazon Rekognition と連携し、ラベル検出や画像プロパティの分析機能を提供します。検出パラメータのカスタマイズも可能で、信頼度閾値や最大検出数、カスタムフィルタなどを設定できます。このツールを使えば、画像内の物体・風景・活動内容を特定できるだけでなく、空間的な位置情報を示す詳細なバウンディングボックス情報も取得可能です。

エージェントの回答: 画像に付与されたラベルを検出するお手伝いをします。まずはコンピュータービジョン専門機能で画像を分析します。
分析が完了しましたので、検出結果を表示します。
画像ラベル検出結果
コンピュータービジョンによる分析で、以下のラベルが検出されました。
主要なラベル(信頼度スコア付き)
- 動物 (99.99%)
- ネコ (99.99%)
- 子猫 (99.99%)
- 哺乳類 (99.99%)
- ペット (99.99%)
- 芝生 (99.99%)
- 植物 (99.99%)
- 芝生の庭 (95.56%)
- マンクス種 (77.85%)
詳細情報:
- 画像には 5 匹の猫または子猫が含まれており、それぞれ個別にバウンディングボックスで検出されています。
- 猫たちは芝生や庭の上にいます。
- 1 匹はマンクス種である可能性が高いです(信頼度 77.85%)。
- 主な色調はグレー系、グリーン系、ブラウン系のグラデーションです。
画像には、芝生の庭でくつろぐ複数の子猫または猫が写っています。
crop_bounding_boxツールは、Amazon Rekognition の物体検出機能を利用しています。このサービスを使って画像を切り取る場合、まず顔やオブジェクト、テキストなどの主要要素を特定するために画像を分析し、その結果として得られる正確なバウンディングボックス座標を用いて、画像を知的にトリミングします。
remove_backgroundツールは、複雑なセットアップや高度な機械学習(ML)の専門知識を必要とせず、画像から背景を除去するためのソリューションである「rembg」ライブラリを使用しています。

OpenSearch サーバー
OpenSearch MCP サーバーは、画像の取り込みと検索を一元化するための統一されたインターフェースを提供します。このサーバーで利用可能なツールは以下の通りです:
「generate_image_description」ツールは、Amazon Bedrock の Claude モデルを活用して画像を解析し、自然言語による説明文を生成します。まず画像を Claude のマルチモーダル機能に対応した形式に変換した後、視覚的な内容に基づいて詳細かつ文脈に即した説明を作成します。
「generate_multimodal_embedding」ツールは、Amazon Titan のマルチモーダルモデルを用いて、視覚情報とテキスト情報の両方を捉えた高次元のベクトル表現(埋め込み)を生成します。これらの埋め込みは、画像とテキストの意味的な関係を共有ベクトル空間に符号化するため、類似度の比較や異種モダリティ間の検索タスクを可能にします。
「ingest_image_to_opensearch」ツールは、OpenSearch への画像処理と保存を一貫して行うエンドツーエンドのパイプラインです。画像の説明生成とマルチモーダル埋め込みの作成機能を組み合わせ、適切なメタデータとともに OpenSearch にインデックス化します。
「query_images_by_text」ツールは、OpenSearch に格納されたマルチモーダル埋め込みを活用し、自然言語による画像コレクション内の検索をサポートします。ユーザーはテキストクエリで画像を検索でき、入力されたテキストも埋め込みに変換されて保存済みの画像埋め込みと比較され、意味的に最も類似する結果が抽出されます。

「query_images_by_image」ツールは、画像をクエリ入力として使用して類似画像を検索する機能を実装しています。このツールは、クエリ画像から埋め込みベクトル(embedding)を生成し、OpenSearch に保存された他の画像の埋め込みベクトルと比較して類似度検索を行います。

エージェントの応答: 提供された画像と類似する画像を「images」インデックス内から探すお手伝いをします。まずはこの画像を分析し、その後で類似画像を検索します。検索結果によると、クエリに一致する類似画像が 1 つ見つかりましたので、元の画像と見つけた類似画像の両方をお見せしましょう。
「images」インデックス内で提供された画像と類似する画像が見つかりました。
以下に見つかった内容を示します。
- 元の画像:森の樹幹にとまっているオジロワシ(Strix varia)。大きな目と、樹皮に溶け込むカモフラージュ効果を持つ斑点模様の羽が特徴です。
- 類似画像:森林環境で枝にとまる小さなフクロウの写真。こちらも大きく見開いた鋭い目と、森の背景に馴染むふさふさとした羽毛を持っています。
両画像間の類似度スコアは 0.65(数値が高いほど類似度が高い)です。視覚的特徴と文脈を考慮すると、これは良好な一致と言えます。どちらもフクロウが自然な森の生息地で撮影されたもので、構図や被写体の共通点が見られます。
さらに別のキーワードで類似画像を検索しますか?それとも、これらのフクロウの写真について詳細情報が必要ですか?
- bulk_ingest_images ツールは、大量の画像をバッチ処理する機能を提供します。複数の画像に対して同時に説明の生成と埋め込み(embedding)を作成するプロセスを最適化し、並列処理やリソースの利用効率を管理します。
セットアップと依存関係
ここまでで、異なる機能について解説してきましたが、
1. Call crop_bounding_box("image.jpg", "person") - "cropped_person_123.jpg"
2. Call crop_bounding_box("image.jpg", "dog") - "cropped_dog_456.jpg"
3. Call ui_show_images(["cropped_person_123.jpg", "cropped_dog_456.jpg"])原文を表示
The integration of AI into real-world applications has long been hindered by a fundamental challenge: the disconnect between systems that can see, systems that can think, and systems that can act. Developers have struggled with complex integrations, managing multiple APIs, and creating custom solutions to bridge these gaps, resulting in inefficient, costly, and often fragile implementations.
We are converging the three key technologies: Computer Vision, Strands Agents, and the Model Context Protocol (MCP). Together, they create a pipeline where visual information can be captured, understood, and acted upon within a unified framework. This integration reduces the traditional barriers between perception, decision-making, and action, letting AI systems operate more like human intelligence by seeing, understanding, and responding in a coordinated way.
In this post, we walk you through the Computer Vision MCP Server, which illustrates this approach, representing how AI systems can process visual information and make intelligent decisions through a single, standardized interface. This convergence transforms what was once a complex integration challenge into a streamlined process, making AI capabilities accessible to a broader range of applications and developers.
Solution overview
In our architecture, the client interacts with multiple Amazon Web Services (AWS) through a centralized AWS Identity and Access Management (IAM) role, which serves as the security gateway for managing permissions. Amazon Simple Storage Service (Amazon S3) handles object storage to retrieve and manage data. Amazon OpenSearch provides search capabilities for querying the indexed data. Amazon Bedrock offers generative AI models, granting the client access to AI tools for tasks like text generation for the agent. Finally, Amazon Rekognition specializes in image analysis, performing functions such as object detection. The architecture emphasizes a unified security model, where the IAM role centralizes permission management, which removes the need for embedded credentials in the client and streamlines controlled access across multiple AWS services.

Computer vision, Strands Agents, and MCP servers
The solution uses three main technologies. Computer vision focuses on processing visual information such as photos and videos. Strands Agents is a framework for building AI agents that supports multiple model providers and deployment targets, offering a customizable agent loop with production capabilities including observability, tracing, and scalable deployment. Lastly, the Model Context Protocol (MCP) is a standard designed to simplify how AI systems integrate with tools and data sources, replacing the process of building separate connections for each AI model and data source pair.
User interface (MCP client)

The interface features a Streamlit chat UI. On the left side, there’s a menu panel where users can select their preferred foundation model for analysis, defaulted to Claude 4 Sonnet with reasoning capabilities that include both Claude 4 Sonnet and Claude 3.7 Sonnet options. Users also can reset their conversation history through a dedicated button in this sidebar.
To use this application, users can upload their visual content through the prominent Media Upload section in the center of the interface. The system accepts both images and videos, supporting a wide range of formats including PNG, JPG, JPEG, GIF, WEBP for images, and MP4, AVI, MOV, MKV, WEBM, MPEG4 for videos, with a maximum file size limit of 200 MB. Users can either drag and drop their files directly into the designated upload area or select Browse files to manually select files from their device. After the media is uploaded, the AI system can perform various analysis tasks such as object cropping, label detection, and detailed content analysis. Users can then interact with the system through the message input field at the bottom of the interface, asking specific questions about their uploaded media or requesting types of analysis.
The following is the system prompt used by the agent:
SYSTEM_PROMPT = """You are a specialized computer vision agent with direct access to CV tools.
YOUR ROLE: Single-agent CV specialist
- Handle image/video analysis, cropping, background removal, label detection
- Process user requests directly using available tools
- Provide clear, actionable responses with visual results
AVAILABLE TOOLS:
1. crop_bounding_box(image_filename, object_name) - Returns "cropped_image_filename"
...
TOOL USAGE PATTERNS:
Cropping Workflow:- Call crop_bounding_box("image.jpg", "person") - "cropped_person_123.jpg"
- Call crop_bounding_box("image.jpg", "dog") - "cropped_dog_456.jpg"
- Call ui_show_images(["cropped_person_123.jpg", "cropped_dog_456.jpg"])
...
VARIABLE PASSING:
- Input: User queries with uploaded filenames in context
...
EFFICIENCY RULES:
- Use ui_show_images for multiple results (creates better layouts)
...
RESPONSE FORMAT:
1. Acknowledge the request
2. Execute appropriate tools in logical sequence
3. Display results using UI tools
4. Summarize what was accomplished
- Call ui_show_images with ["image_bg_removed_123456.png"] to display the result
Example workflow for video analysis:
- Call analyze_video with video filename and specific monitoring instructions
- The tool will return detailed analysis results
Always report back error messages exactly as received.
"""Computer vision MCP servers
Our implementation is composed of two servers namely the CV server and the OpenSearch server. Each handles different types of requests as described in the following section.
CV server
The AWS Computer Vision MCP server provides a unified interface for image and video analysis by consolidating three Amazon AI services into a standardized protocol. This integration lets AI agents access and process visual content through a consistent API, which streamlines the development of computer vision applications. The following tools are available in the MCP server:
- The describe_image tool uses the Claude model in Amazon Bedrock to provide image analysis based on specific monitoring instructions. This function retrieves images from Amazon S3 storage and processes them through Claude’s multimodal capabilities to support AI-powered interpretation of visual content. It’s useful for scenarios requiring descriptions, or specific attribute identification within images, returning analysis results along with status information.

Agent Response: I’ll help you describe the uploaded image. Let me analyze it first using the computer vision agent. Now I’ll display the image with the description:
Image Description
The uploaded image shows a rural outdoor scene featuring:
A sheep in the foreground (detected with 99.07% confidence)
The sheep appears to be grazing in a meadow or pasture
The sheep has predominantly gray/white coloring
The setting is a grassland/meadow environment
The background consists of green fields typical of countryside or pastoral landscapes
The scene has natural outdoor lighting
The image captures a peaceful rural scene with the sheep positioned in the center of the frame against the backdrop of green meadows. The dominant colors are various shades of green in the background (representing the grassland) and gray/white tones of the sheep in the foreground.
This is a nature photograph capturing livestock in its natural pastoral environment, showing the sheep grazing in an open field.
The following code snippet from the describe_image tool represents the overall structure of a tool:
async def describe_image(image_file_name: str, monitoring_instructions: str) ...
try:
# Get the image from S3
prefix = f"mcp/{image_file_name}"
print(f"\n[DEBUG] Attempting to analyze image at s3://{Connections.agent_bucket_name}/{prefix}\n")
response = Connections.s3_client.get_object(
Bucket=Connections.agent_bucket_name,
Key=prefix
)
image_data = response['Body'].read()
content_type = response['ContentType']
# Ensure content type is supported by Bedrock
valid_content_types = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']
if content_type not in valid_content_types:
# Try to determine from file extension
if image_file_name.lower().endswith(('.jpg', '.jpeg')):
content_type = 'image/jpeg'
elif image_file_name.lower().endswith('.png'):
content_type = 'image/png'
elif image_file_name.lower().endswith('.gif'):
content_type = 'image/gif'
elif image_file_name.lower().endswith('.webp'):
content_type = 'image/webp'
else:
content_type = 'image/jpeg' # Default fallback
print(f"[DEBUG] Content type corrected to: {content_type}")
# Create the prompt for Claude
prompt = create_multimodal_prompt(
image_data=image_data,
text=monitoring_instructions,
content_type=content_type,
system_prompt=(
"You are a helpful assistant that analyzes images. "
"Provide detailed, accurate descriptions based on the user's instructions."
)
)
# Get analysis from Claude
analysis = invoke_bedrock_model(prompt)
return ImageAnalysisResponse(
status="success",
source=prefix,
analysis=analysis,
message="Image analysis completed successfully"
)
except Exception as e:
logger.error(f"Error analyzing image: {str(e)}")
return ImageAnalysisResponse(
status="error",
source=image_file_name,
analysis=None,
message=f"Error analyzing image: {str(e)}"
)- The analyze_video tool uses Amazon Nova video analysis capabilities to process video content. This function handles video files stored in S3 and can analyze them according to specific instructions.
Uploaded Video:

User: Analyze the uploaded video
Agent Response: I’ll help you analyze the uploaded video. Let me delegate this task to the computer vision specialist.
l’ve analyzed your uploaded video (15dc6b31_19642406-uhd_3840_2160_30fps.mp4) and here’s what I found:
Content Description
The video features a close-up view of a plant (likely a type of grass) covered in snow
It’s set in a field on what appears to be a sunny winter day
The background is intentionally blurry, creating a natural depth of field effect that draws attention to the main subject
Visual Elements
There’s a striking visual contrast between the white snow and the natural green elements of the plant
The snow is distributed unevenly across the plant’s long, thin leaves
The snow appears to be melting slightly, suggesting mild temperatures
- The detect_labels tool integrates with Amazon Rekognition to provide label detection and image property analysis. It offers control over detection parameters, including confidence thresholds, maximum label counts, and custom label filters. The tool can identify objects, scenes, and activities within images while providing detailed bounding box information for spatial localization.

Agent Response: I’ll help you detect labels in your uploaded image. Let me analyze it using the computer vision specialist.Now that I’ve analyzed the image, let me display it with the detected labels:## Image Label Detection Results
The computer vision analysis detected the following labels in your image:
Main Labels (with confidence scores):
Animal (99.99%)
Cat (99.99%)
Kitten (99.99%)
Mammal (99.99%)
Pet (99.99%)|
Grass (99.99%)
Plant (99.99%)|
Lawn (95.56%)
Manx (77.85%)
Details:
The image contains 5 cats/kittens (detected with individual bounding boxes)
The cats appear to be on grass/lawn
One of the cats may be a Manx breed (77.85% confidence)
The dominant colors include various shades of gray, green, and brown
The image primarily shows multiple kittens or cats relaxing on a grassy lawn area.
- The crop_bounding_box utilizes Amazon Rekognition for its object detection features. When using Amazon Rekognition for cropping, the service first analyzes the image to identify key elements such as faces, objects, or text, then provides precise bounding box coordinates that can be used to intelligently crop the image.
- The remove_background tool uses the rembg library which is a solution for background removal from images without requiring complex setup or extensive machine learning (ML) expertise.

OpenSearch server
The OpenSearch MCP server provides a unified interface for the ingestion and retrieval of images. The following tools are available in the MCP server:
- The generate_image_description tool uses the Amazon Bedrock Claude models to analyze images and generate natural language descriptions. It processes images by first converting them into a format compatible with Claude’s multimodal capabilities, then generates detailed, contextual descriptions based on the visual content.
- The generate_multimodal_embedding tool uses the Amazon Titan multimodal models to create high-dimensional vector representations (embeddings) that capture both visual and textual information. These embeddings encode semantic relationships between images and text in a shared vector space, which supports similarity comparisons and cross-modal retrieval tasks.
- The ingest_image_to_opensearch tool provides an end-to-end pipeline for processing and storing images in OpenSearch. It combines the capabilities of image description generation and multimodal embedding creation, then indexes this information in OpenSearch with appropriate metadata.
- The query_images_by_text tool supports natural language search across image collections by using the multimodal embeddings stored in OpenSearch. Users can search for images using text queries, which are converted into embeddings and compared against the stored image embeddings to find the most semantically similar matches.

- The query_images_by_image tool implements image-based search functionality, allowing users to find similar images by using an image as the query input. It processes the query image to generate its embedding and then performs similarity searches against the stored image embeddings in OpenSearch.

Agent Response: I’ll help you find similar images to the one you provided in the “images” index. Let me analyze this image first and then search for similar ones. Based on the search results, I found one similar image in the “images index that matches your query. Let me show you both the original image and the similar one I found:l’ve found a similar image to the one you provided in the”images” index.
Here’s what I found:
Original Image: A Barred Owl (Strix varia) perched on a tree trunk in a forest setting. The owl has distinctive large eyes and mottled plumage that creates effective camouflage against the tree bark.
Similar Image Found: Another owl image showing a small owl perched on a tree branch in a forest environment. This owl also has large, alert eyes and fluffy feathers that help it blend with its woodland surroundings.
The similarity score between these images is 0.65 (on a scale where higher is more similar), indicating a good match based on the visual elements and context of both images. Both photos capture owls in their natural forest habitat with similar composition and subject matter.
Would you like me to search for more similar images using different keywords, or would you like more information about either of these owl images?
- The bulk_ingest_images tool provides batch processing capabilities for large-scale image ingestion. It optimizes the process of generating descriptions and embeddings for multiple images simultaneously, managing parallel processing and resource utilization.
Setup and dependencies
Now that we’ve gone through the different featu
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み