MCP Server Framework - v1.0.0
    Preparing search index...

    Type Alias PingHandler

    PingHandler: () => void | Promise<void>

    Custom ping handler callback.

    Called when a ping request is received from an MCP client. Use for health checks, metrics, heartbeat tracking, or custom logic.

    The return value is ignored - ping always returns an empty object per MCP specification. If the handler throws, the ping still succeeds (errors are logged but not propagated to the client).

    Type Declaration

      • (): void | Promise<void>
      • Returns void | Promise<void>

    const options: ServerOptions = {
    // ...
    handlers: {
    onPing: async () => {
    metrics.increment('mcp.ping.received');
    await healthChecker.recordHeartbeat();
    },
    },
    };