Skip to main content
Glama

sleep

Pause task execution for a specified duration to control workflow timing. Introduces timed delays for managing sequences in automation, ensuring tasks proceed as planned after waiting periods.

Instructions

If you need to wait for a few seconds to continue with the task you are performing .

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
secondsYesseconds it will take me to tell you to continue.

Implementation Reference

  • The main handler function for MCP tool calls, specifically executes the 'sleep' tool by validating input, respecting config timeout, calling SleepFetcher.wait(), and returning success message.
    @app.call_tool()
    async def call_tool(name: str, arguments: Any) -> Sequence[TextContent]:
        """Handle tool calls for Sleep."""
        ctx = app.request_context.lifespan_context
        try:
            if name == "sleep":
                if not ctx:
                    raise ValueError("Sleep is not configured.")
                seconds = arguments.get("seconds")
                if not seconds:
                    raise ValueError("Seconds is required.")
    
                if seconds > int(ctx.sleep.config.timeout):
                    return [
                        TextContent(
                            type="text",
                            text=f"My configuration does not allow me to make you wait more than {ctx.sleep.config.timeout} seconds",  # noqa: E501
                        )
                    ]
                # Sleep seconds value
                await ctx.sleep.wait(seconds)
    
                return [
                    TextContent(
                        type="text",
                        text=f"You can continue to do your task after you've been waiting {seconds} seconds",  # noqa: E501
                    )
                ]
    
            raise ValueError(f"Unknown tool: {name}")
    
        except Exception as e:
            logger.error(f"Tool execution error: {str(e)}")
            return [TextContent(type="text", text=f"Error: {str(e)}")]
  • Registers the 'sleep' tool by providing its schema and description in the list_tools handler.
    @app.list_tools()
    async def list_tools() -> list[Tool]:
        """List available Sleep tools."""
        tools = []
        ctx = app.request_context.lifespan_context
    
        # Add Sleep tools if Sleep is configured
        if ctx:
            tools.extend(
                [
                    Tool(
                        name="sleep",
                        description="If you need to wait for a few seconds to continue with the task you are performing .",  # noqa: E501
                        inputSchema={
                            "type": "object",
                            "properties": {
                                "seconds": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": ctx.sleep.config.timeout,
                                    "description": "seconds it will take me to tell you to continue."  # noqa: E501
                                }
                            },
                            "required": ["seconds"],
                        },
                    ),
                ]
            )
        return tools
  • Defines the input schema for the 'sleep' tool, including seconds parameter with min/max bounds from config.
        Tool(
            name="sleep",
            description="If you need to wait for a few seconds to continue with the task you are performing .",  # noqa: E501
            inputSchema={
                "type": "object",
                "properties": {
                    "seconds": {
                        "type": "number",
                        "minimum": 0,
                        "maximum": ctx.sleep.config.timeout,
                        "description": "seconds it will take me to tell you to continue."  # noqa: E501
                    }
                },
                "required": ["seconds"],
            },
        ),
    ]
  • Helper class providing the wait method that executes asyncio.sleep(seconds), the core sleep logic.
    class WaitMixin(SleepClient):
        """Mixin for Sleep waits operations."""
    
        async def wait(self, seconds: int) -> None:
            """
            Get an aggregated overview of findings and resources grouped by providers.
    
            Returns:
                Dictionary containing provider information with results and
                metadata
            """  # noqa: E501
            await asyncio.sleep(seconds)
            return
  • The SleepFetcher class that inherits WaitMixin, used by the server to perform the sleep operation.
    class SleepFetcher(WaitMixin):
        """Main entry point for Sleep operations, providing backward
        compatibility.
    
        This class combines functionality from various mixins to maintain the same
        API as the original SleepFetcher class.
        """
    
        pass
    
    __all__ = ["SleepFetcher","SleepConfig", "SleepClient"]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions waiting behavior but omits key details: whether it blocks execution, if it's synchronous/asynchronous, error handling, or side effects. The phrase 'tell you to continue' hints at notification but is ambiguous. For a tool with no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function. It's appropriately sized for a simple tool, with no redundant or verbose phrasing. However, it could be more front-loaded by starting with the core action (e.g., 'Pauses execution for a specified duration').

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, return values, or error cases. With no output schema, it should ideally hint at what happens after waiting (e.g., resumes task). It's complete enough for a simple tool but has room for improvement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the parameter 'seconds' well-documented in the schema (type, range, purpose). The description adds no parameter-specific information beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose as waiting/pausing execution ('wait for a few seconds'), which is clear but somewhat vague. It doesn't specify what resource or system it operates on, and with no sibling tools, differentiation isn't needed. The description avoids tautology by explaining function rather than just restating the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context ('to continue with the task you are performing'), suggesting it's for pacing or timing in workflows. However, it lacks explicit guidance on when to use vs. alternatives (though none exist), prerequisites, or specific scenarios. The guidance is functional but minimal.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AgentsWorkingTogether/mcp-sleep'

If you have feedback or need assistance with the MCP directory API, please join our Discord server