Interface ContextNotifications

All Superinterfaces:
Notifications

public interface ContextNotifications extends Notifications
Handler-facing notification surface used from within an interaction (handler dispatch) context. Extends the public Notifications logging surface with progress and keep-alive operations.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Sends empty SSE comment line (:\r\n).
    void
    comment(@Nullable String message)
    Sends a raw SSE comment line (: message) on the response stream, upgrading a buffered POST response to text/event-stream if it has not started yet.
    void
    progress(@Nullable ProgressToken progressToken, double progress, double total, String message)
    Sends a progress notification.

    Methods inherited from interface dev.tachyonmcp.api.runtime.Notifications

    error, info, log, log, warning
  • Method Details

    • progress

      void progress(@Nullable ProgressToken progressToken, double progress, double total, String message)
      Sends a progress notification.

      The first server→client message on a POST also upgrades its response to an SSE stream and arms the heartbeat, keeping the connection alive past readerIdleTimeout — so emitting an early progress(...) is the keep-alive mechanism for long-running tools.

      progressToken should be the client's request _meta.progressToken (e.g. ToolRequest.progressToken()). When it is null the client did not opt into progress, so the notification is silently dropped per the MCP spec — handlers may emit progress unconditionally without null-checking the token.

    • comment

      @ExperimentalApi void comment(@Nullable String message)
      Sends a raw SSE comment line (: message) on the response stream, upgrading a buffered POST response to text/event-stream if it has not started yet.

      Unlike progress(dev.tachyonmcp.api.server.domain.ProgressToken, double, double, java.lang.String), this needs no progress token — it carries no MCP message, only transport-level bytes the client ignores. Use it to keep a long-running request's connection alive when no progress token is available. A null or blank message emits a bare : heartbeat comment. No-op when no outbound stream is bound to the context.

    • comment

      @ExperimentalApi default void comment()
      Sends empty SSE comment line (:\r\n).
      See Also: