Add Trace-level logging for JSON-RPC payloads in transports (#1191)
This commit is contained in:
parent
5b189aff0a
commit
ee8c485d41
1 changed files with 90 additions and 2 deletions
|
|
@ -74,7 +74,9 @@ public class StreamServerTransport : TransportBase
|
|||
|
||||
try
|
||||
{
|
||||
await JsonSerializer.SerializeAsync(_outputStream, message, McpJsonUtilities.DefaultOptions.GetTypeInfo(typeof(JsonRpcMessage)), cancellationToken).ConfigureAwait(false);
|
||||
var json = JsonSerializer.Serialize(message, McpJsonUtilities.JsonContext.Default.JsonRpcMessage);
|
||||
LogTransportSendingMessageSensitive(Name, json);
|
||||
await _outputStream.WriteAsync(Encoding.UTF8.GetBytes(json), cancellationToken).ConfigureAwait(false);
|
||||
await _outputStream.WriteAsync(s_newlineBytes, cancellationToken).ConfigureAwait(false);
|
||||
await _outputStream.FlushAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue