Skip to content

Commit

Permalink
Enhance timeout handling in mcp_tools.py by adding 30-second timeout …
Browse files Browse the repository at this point in the history
…decorators to list_tools and call_tool functions, and update GitHub Actions workflow to include a sleep command before running pre-commit checks for improved reliability.
  • Loading branch information
onuratakan committed Jan 6, 2025
1 parent 7ec539d commit 8b1097e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run_uv_commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
run-uv-commands:
runs-on: macos-latest
runs-on: ubuntu-latest

steps:
- name: Checkout repository
Expand All @@ -34,4 +34,4 @@ jobs:

- name: Run Pre-commit
run: |
uv run run_tools_server.py & uv run run_main_server.py & uvx pre-commit run
uv run run_tools_server.py & uv run run_main_server.py & sleep 10 && uvx pre-commit run
2 changes: 2 additions & 0 deletions src/upsonicai/server/tools/server/mcp_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async def managed_session(command: str, args: list, env: dict | None = None):


@app.post(f"{prefix}/tools")
@timeout(30.0)
async def list_tools(request: ListToolsRequest):
print("Listing tools...")

Expand All @@ -87,6 +88,7 @@ async def list_tools(request: ListToolsRequest):


@app.post(f"{prefix}/call_tool")
@timeout(30.0)
async def call_tool(request: ToolRequest):
print(f"Received tool call request: {request}")

Expand Down

0 comments on commit 8b1097e

Please sign in to comment.