fix: move MCPClient imports inside try block, add TOOLS.md placeholder

This commit is contained in:
daniel
2026-05-15 09:29:07 -05:00
parent add8c6c988
commit 17b1536dae
2 changed files with 8 additions and 3 deletions

View File

@@ -5,8 +5,6 @@ Entrypoint for AgentCore CodeZip deployment.
"""
import os
from strands import Agent, tool
from strands.tools.mcp import MCPClient
from mcp.client.streamable_http import streamablehttp_client
from strands.models import BedrockModel
from bedrock_agentcore.runtime import BedrockAgentCoreApp
@@ -470,13 +468,17 @@ async def main(payload: dict, context):
_aws_mcp_client = None
_aws_mcp_tools = []
try:
from strands.tools.mcp import MCPClient
from mcp.client.streamable_http import streamablehttp_client
_aws_mcp_client = MCPClient(
lambda: streamablehttp_client(config.AWS_MCP_URL, auth=_AwsMcpSigV4Auth())
)
_aws_mcp_client.start()
_aws_mcp_tools = [_aws_mcp_client]
except Exception as _e:
print(f'[main] AWS MCP client failed to start: {_e}')
import traceback
print(f"[main] AWS MCP client failed to start: {type(_e).__name__}: {_e}")
print(traceback.format_exc())
all_tools = base_tools + mcp_clients + _aws_mcp_tools

3
workspace/TOOLS.md Normal file
View File

@@ -0,0 +1,3 @@
# Tools
This file documents available tools for the agent-claw runtime.