fix(mcp): Restore synchronous dispatch and update mcp_server to use async_dispatch.

This commit is contained in:
2026-03-06 14:03:41 -05:00
parent 9d5b874c66
commit 5a484c9e82
2 changed files with 38 additions and 43 deletions

View File

@@ -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}")]