Skip to content

Commit c4666cc

Browse files
authored
fix: f-strings formatting in logging (#67)
1 parent bb3eebe commit c4666cc

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

mcp_proxy_for_aws/middleware/tool_filter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async def on_list_tools(
3434
"""Filter tools based on read only flag."""
3535
# Get list of FastMCP Components
3636
tools = await call_next(context)
37-
self.logger.info(f'Filtering tools for read only: {self.read_only}')
37+
self.logger.info('Filtering tools for read only: %s', self.read_only)
3838

3939
# If not read only, return the list of tools as is
4040
if not self.read_only:
@@ -49,7 +49,7 @@ async def on_list_tools(
4949
read_only_hint = getattr(annotations, 'readOnlyHint', False)
5050
if not read_only_hint:
5151
# Skip tools that don't have readOnlyHint=True
52-
self.logger.info(f'Skipping tool {tool.name} needing write permissions')
52+
self.logger.info('Skipping tool %s needing write permissions', tool.name)
5353
continue
5454

5555
filtered_tools.append(tool)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ force-exclude = true
9595

9696
[tool.ruff.lint]
9797
exclude = ["__init__.py"]
98-
select = ["C", "D", "E", "F", "I", "W"]
98+
select = ["C", "D", "E", "F", "G", "I", "W"]
9999
ignore = ["C901", "E501", "E741", "F402", "F823", "D100", "D106"]
100100

101101
[tool.ruff.lint.isort]

tests/integ/conftest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ def _build_endpoint_environment_remote_configuration():
7777

7878
region_name = os.environ.get('AWS_REGION')
7979
if not region_name:
80-
logger.warn('AWS_REGION param not set. Defaulting to us-east-1')
80+
logger.warning('AWS_REGION param not set. Defaulting to us-east-1')
8181
region_name = 'us-east-1'
8282

83-
logger.info(f'Starting server with config - {remote_endpoint_url=} and {region_name=}')
83+
logger.info(
84+
'Starting server with config - remote_endpoint_url=%s and region_name=%s',
85+
remote_endpoint_url,
86+
region_name,
87+
)
8488

8589
return RemoteMCPServerConfiguration(
8690
endpoint=remote_endpoint_url,

tests/integ/mcp/simple_mcp_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def build_mcp_client(endpoint: str, region_name: str) -> fastmcp.Client:
2323

2424

2525
async def _basic_elicitation_handler(message: str, response_type: type, params, context):
26-
logger.info(f'Server asks: {message} with response_type {response_type}')
26+
logger.info('Server asks: %s with response_type %s', message, response_type)
2727

2828
# Usually the Handler would expect an user Input to control flow via Accept, Decline, Cancel
2929
# But in this Integ test we only care that an Elicitation request went through the handler

tests/integ/test_proxy_dynamic_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ async def test_proxy_reflects_tool_addition(mcp_client: fastmcp.Client, is_using
1818
initial_tools = await mcp_client.list_tools()
1919
initial_tool_names = [tool.name for tool in initial_tools]
2020

21-
logger.info(f'Initial tools: {initial_tool_names}')
21+
logger.info('Initial tools: %s', initial_tool_names)
2222

2323
# Verify 'multiply' tool doesn't exist yet
2424
assert 'multiply' not in initial_tool_names, 'multiply tool should not exist initially'
2525

2626
# Act - Trigger backend to dynamically add a new tool
2727
logger.info('Calling add_tool_multiply to add a new tool to the backend')
2828
add_result = await mcp_client.call_tool('add_tool_multiply', {})
29-
logger.info(f'Backend response: {add_result}')
29+
logger.info('Backend response: %s', add_result)
3030

3131
# Get updated tool list
3232
updated_tools = await mcp_client.list_tools()
3333
updated_tool_names = [tool.name for tool in updated_tools]
3434

35-
logger.info(f'Updated tools: {updated_tool_names}')
35+
logger.info('Updated tools: %s', updated_tool_names)
3636

3737
# Assert
3838
# The proxy should reflect the newly added tool

0 commit comments

Comments
 (0)