wait
Pause execution for specified seconds to manage timing in web automation tasks, preventing rapid polling and allowing processes to complete.
Instructions
Wait for a specified number of seconds before continuing.
Use this when you need to pause between operations, such as:
- Waiting between status checks to avoid rapid polling
- Giving a web task time to make progress
- Rate limiting your requests
- Waiting for external processes to complete
Args:
seconds: Number of seconds to wait (1-60)
Returns:
Dictionary containing:
- ok: Boolean indicating success
- waited_seconds: How long the wait lasted
- message: Confirmation message
Examples:
- wait(5) # Wait 5 seconds
- wait(10) # Wait 10 seconds
Best Practice:
Use this instead of immediately polling check_web_task multiple times.
Recommended wait time between status checks: 3-5 seconds.
Note: Maximum wait time is 60 seconds to prevent timeout issues.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seconds | Yes |
Implementation Reference
- server.py:311-311 (registration)Registration of the 'wait' tool using the @mcp.tool() decorator.@mcp.tool()
- server.py:312-366 (handler)The handler function for the 'wait' tool. Validates input (1-60 seconds), sleeps asynchronously using anyio.sleep, logs progress, and returns success status with waited duration.async def wait(seconds: int) -> dict[str, Any]: """ Wait for a specified number of seconds before continuing. Use this when you need to pause between operations, such as: - Waiting between status checks to avoid rapid polling - Giving a web task time to make progress - Rate limiting your requests - Waiting for external processes to complete Args: seconds: Number of seconds to wait (1-60) Returns: Dictionary containing: - ok: Boolean indicating success - waited_seconds: How long the wait lasted - message: Confirmation message Examples: - wait(5) # Wait 5 seconds - wait(10) # Wait 10 seconds Best Practice: Use this instead of immediately polling check_web_task multiple times. Recommended wait time between status checks: 3-5 seconds. Note: Maximum wait time is 60 seconds to prevent timeout issues. """ # Validate input if seconds < 1: return { "ok": False, "error": "Wait time must be at least 1 second" } if seconds > 60: return { "ok": False, "error": "Wait time cannot exceed 60 seconds. For longer waits, call this tool multiple times." } logger.info(f"Waiting for {seconds} seconds...") # Use anyio sleep for async compatibility import time await anyio.sleep(seconds) logger.info(f"Wait completed: {seconds} seconds") return { "ok": True, "waited_seconds": seconds, "message": f"Successfully waited {seconds} seconds" }
- server.py:323-323 (schema)Input schema definition in the docstring: seconds (int, 1-60). Output schema: dict with ok, waited_seconds, message (and error on failure).seconds: Number of seconds to wait (1-60)