fix(mcp): Restore synchronous dispatch and update mcp_server to use async_dispatch.
This commit is contained in:
@@ -70,9 +70,10 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
|
||||
try:
|
||||
if name == "run_powershell":
|
||||
script = arguments.get("script", "")
|
||||
result = shell_runner.run_powershell(script, os.getcwd())
|
||||
# run_powershell is synchronous, so we run it in a thread to avoid blocking the loop
|
||||
result = await asyncio.to_thread(shell_runner.run_powershell, script, os.getcwd())
|
||||
else:
|
||||
result = mcp_client.dispatch(name, arguments)
|
||||
result = await mcp_client.async_dispatch(name, arguments)
|
||||
return [TextContent(type="text", text=str(result))]
|
||||
except Exception as e:
|
||||
return [TextContent(type="text", text=f"ERROR: {e}")]
|
||||
|
||||
Reference in New Issue
Block a user