Skip to main content
Glama
NimbleBrainInc

MCP Echo Service

echo_with_delay

Simulate delayed responses in MCP protocol testing by echoing messages after a specified wait time up to 5 seconds.

Instructions

Echo back a message after a simulated delay.

Args: message: The message to echo back delay_seconds: Delay duration in seconds (max 5.0 seconds) ctx: MCP context

Returns: Echo response with timing information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYes
delay_secondsNo

Implementation Reference

  • The handler function for the 'echo_with_delay' tool, which performs a sleep and returns timing data.
    async def echo_with_delay(
        message: str, delay_seconds: float = 1.0, ctx: Context | None = None
    ) -> EchoDelayResponse:
        """Echo back a message after a simulated delay.
    
        Args:
            message: The message to echo back
            delay_seconds: Delay duration in seconds (max 5.0 seconds)
            ctx: MCP context
    
        Returns:
            Echo response with timing information
        """
        # Limit delay to maximum of 5 seconds for safety
        delay_seconds = min(float(delay_seconds), 5.0)
    
        if ctx:
            await ctx.info(f"Echoing with {delay_seconds}s delay: {message[:50]}...")
    
        start_time = datetime.now(UTC)
        time.sleep(delay_seconds)
        end_time = datetime.now(UTC)
    
        return EchoDelayResponse(
            original_message=message,
            echoed_message=message,
            requested_delay=delay_seconds,
            actual_delay=(end_time - start_time).total_seconds(),
            start_time=start_time.isoformat(),
            end_time=end_time.isoformat(),
            timestamp=end_time.isoformat(),
  • Registration of 'echo_with_delay' tool using the @mcp.tool() decorator.
    @mcp.tool()
  • Pydantic model defining the response schema for the 'echo_with_delay' tool.
    """Response model for echo_with_delay tool."""
    
    original_message: str = Field(..., description="The original message sent")
    echoed_message: str = Field(..., description="The echoed message")
    requested_delay: float = Field(..., description="Requested delay in seconds")
    actual_delay: float = Field(..., description="Actual delay experienced in seconds")
    start_time: str = Field(..., description="ISO 8601 timestamp when delay started")
    end_time: str = Field(..., description="ISO 8601 timestamp when delay ended")
    timestamp: str = Field(..., description="ISO 8601 timestamp of the operation")
Install Server

Other 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/NimbleBrainInc/mcp-echo'

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