Class McpResponseWriter

java.lang.Object
dev.tachyonmcp.core.transport.netty.McpResponseWriter

public final class McpResponseWriter extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.netty.channel.ChannelFuture
    sendInternalError(io.netty.channel.ChannelHandlerContext ctx, RequestId id, @Nullable String origin, ProtocolResponseMapper mapper)
    Writes a JSON-RPC internal-error response and closes the connection, for a dispatch failure that occurred after a POST-SSE stream had already started (so the normal response path can no longer send a result).
    static io.netty.channel.ChannelFuture
    sendJsonResponse(io.netty.channel.ChannelHandlerContext ctx, byte[] body, io.netty.handler.codec.http.HttpResponseStatus status, boolean close, @Nullable String sessionId, @Nullable String origin)
     
    static io.netty.channel.ChannelFuture
    sendJsonResponse(io.netty.channel.ChannelHandlerContext ctx, byte[] body, io.netty.handler.codec.http.HttpResponseStatus status, @Nullable String sessionId, @Nullable String origin)
     
    static io.netty.channel.ChannelFuture
    sendJsonResponse(io.netty.channel.ChannelHandlerContext ctx, byte[] body, @Nullable String sessionId, @Nullable String origin)
     
    static void
    sendOptions(io.netty.channel.ChannelHandlerContext ctx, @Nullable String origin)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • sendOptions

      public static void sendOptions(io.netty.channel.ChannelHandlerContext ctx, @Nullable String origin)
    • sendJsonResponse

      public static io.netty.channel.ChannelFuture sendJsonResponse(io.netty.channel.ChannelHandlerContext ctx, byte[] body, @Nullable String sessionId, @Nullable String origin)
    • sendJsonResponse

      public static io.netty.channel.ChannelFuture sendJsonResponse(io.netty.channel.ChannelHandlerContext ctx, byte[] body, io.netty.handler.codec.http.HttpResponseStatus status, @Nullable String sessionId, @Nullable String origin)
    • sendJsonResponse

      public static io.netty.channel.ChannelFuture sendJsonResponse(io.netty.channel.ChannelHandlerContext ctx, byte[] body, io.netty.handler.codec.http.HttpResponseStatus status, boolean close, @Nullable String sessionId, @Nullable String origin)
    • sendInternalError

      public static io.netty.channel.ChannelFuture sendInternalError(io.netty.channel.ChannelHandlerContext ctx, RequestId id, @Nullable String origin, ProtocolResponseMapper mapper)
      Writes a JSON-RPC internal-error response and closes the connection, for a dispatch failure that occurred after a POST-SSE stream had already started (so the normal response path can no longer send a result).
      Parameters:
      ctx - the channel to write the response on
      id - the id of the request that failed
      origin - the request's Origin header value, echoed via CORS headers, or null
      mapper - the protocol response mapper used to encode the error
      Returns:
      the future for the write