Skip to content

Commit 4f1aad3

Browse files
committed
chore: cleaning up repetitive logs + vars
1 parent c8a0cf7 commit 4f1aad3

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

samples/mcp-integration-with-kb/clients/client_server.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,19 @@ async def process_query(query: str, kb_id: str) -> Dict[str, Any]:
126126
if not bedrock_runtime:
127127
raise ValueError('Bedrock client is not initialized')
128128

129-
# Process with MCP client
130-
logger.info('Connecting to MCP server')
131-
# Get tools from the MCP server directly without using context manager
129+
# Get tools from the MCP server
132130
logger.info('Getting tools from MCP server')
133-
original_tools = await mcp_client.get_tools()
134-
tool_names = [tool.name for tool in original_tools]
135-
logger.info(f'Retrieved {len(original_tools)} tools from MCP server: {tool_names}')
131+
tools = await mcp_client.get_tools()
132+
logger.info(
133+
f'Retrieved {len(tools)} tools from MCP server: {[tool.name for tool in tools]}'
134+
)
136135

137-
if not original_tools:
136+
if not tools:
138137
logger.warning('No tools were returned from the MCP server')
139138
return {
140139
'messages': [{'content': 'No tools available from the knowledge base server.'}]
141140
}
142141

143-
# We'll use the original tools
144-
tools = original_tools
145-
146142
# Create a ChatBedrock instance with tools
147143
logger.info('Creating ChatBedrock with tools')
148144
chat_model = ChatBedrock(

samples/mcp-integration-with-nova-canvas/clients/client_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ async def generate_image(request: ImageGenerationRequest) -> Dict[str, Any]:
208208
}
209209
)
210210

211-
# Process with MCP client
212-
logger.info('Connecting to MCP server')
211+
# Get tools from the MCP server
213212
logger.info('Getting tools from MCP server')
214213
tools = await mcp_client.get_tools()
215-
tool_names = [tool.name for tool in tools]
216-
logger.info(f'Retrieved {len(tools)} tools from MCP server: {tool_names}')
214+
logger.info(
215+
f'Retrieved {len(tools)} tools from MCP server: {[tool.name for tool in tools]}'
216+
)
217217

218218
if not tools:
219219
logger.warning('No tools were returned from the MCP server')

0 commit comments

Comments
 (0)