Skip to content

Commit f1233b4

Browse files
authored
remove log level arg from sandbox (#11)
1 parent 568054e commit f1233b4

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

examples/sandbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def log_handler(level: str, message: str):
1818

1919

2020
async def main():
21-
async with code_sandbox(dependencies=['numpy'], log_handler=log_handler, logging_level='debug') as sandbox:
21+
async with code_sandbox(dependencies=['numpy'], log_handler=log_handler) as sandbox:
2222
print('running code')
2323
result = await sandbox.eval(code)
2424
print(f'{result["status"].title()}:')

mcp_run_python/code_sandbox.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ async def code_sandbox(
4242
*,
4343
dependencies: list[str] | None = None,
4444
log_handler: LogHandler | None = None,
45-
logging_level: mcp_types.LoggingLevel | None = None,
4645
allow_networking: bool = True,
4746
) -> AsyncIterator['CodeSandbox']:
4847
"""Run code in a secure sandbox.
4948
5049
Args:
5150
dependencies: A list of dependencies to be installed.
5251
log_handler: A callback function to handle print statements when code is running.
53-
logging_level: The logging level to use for the print handler, defaults to `info` if `log_handler` is provided.
5452
deps_log_handler: A callback function to run on log statements during initial install of dependencies.
5553
allow_networking: Whether to allow networking or not while executing python code.
5654
"""
@@ -75,5 +73,5 @@ async def logging_callback_(params: mcp_types.LoggingMessageNotificationParams)
7573
async with stdio_client(server_params) as (read, write):
7674
async with ClientSession(read, write, logging_callback=logging_callback) as session:
7775
if log_handler:
78-
await session.set_logging_level(logging_level or 'info')
76+
await session.set_logging_level('debug')
7977
yield CodeSandbox(session)

0 commit comments

Comments
 (0)