TsgcWSAPIServer_MCP › Methods › SendLogMessage

SendLogMessage Method

Sends a notifications/message log entry to every session whose logging level allows it.

Syntax

procedure SendLogMessage(aLevel: TsgcAI_MCP_LoggingLevel; const aLogger, aData: string); overload;
procedure SendLogMessage(const aSession: TsgcAI_MCP_Session; aLevel: TsgcAI_MCP_LoggingLevel; const aLogger, aData: string); overload;

Parameters

NameTypeDescription
aSessionTsgcAI_MCP_SessionSecond overload only. Session of the request being processed; the log entry is related to that request.
aLevelTsgcAI_MCP_LoggingLevelRFC 5424 severity of the entry (debug, info, notice, warning, error, critical, alert, emergency).
aLoggerconst stringOptional logger name identifying the component that produced the message.
aDataconst stringFree-form payload (plain text or JSON) delivered to the client as the message body.

Remarks

Fans out a notifications/message entry to every open session whose current logging level (set by the client through logging/setLevel) is at or below aLevel. The notification is only emitted when TransportOptions.HttpStreamable.Enabled is True; short-lived HTTP clients do not receive asynchronous logs. Sessions that opted into a higher severity threshold will silently discard lower-priority entries.

The overload with aSession sends the entry for the request being processed. For a 2026-07-28 request, which has no session, the entry is streamed in the response of that same request, and only when the client asked for logs with logLevel in the request _meta and aLevel is equal to or higher than that level. For a legacy session it behaves like the first overload. See Logging and Progress.

Example

MCPServer.SendLogMessage(aimcpllInfo, 'ops', 'Deployment 42 rolled back successfully.');
// inside a request event, log for the current request only
MCPServer.SendLogMessage(aSession, aimcpllInfo, 'ops', 'Processing request');

Back to Methods