fix: move MCPClient imports inside try block, add TOOLS.md placeholder
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user