While a request is being processed, the server can send log messages (notifications/message) and progress notifications (notifications/progress) to the client that made the request. Use the overloads of SendLogMessage and SendNotificationProgress that receive the session of the current request.
_meta and is available in aRequest.ProgressToken.
Modern requests have no session, so the notifications are streamed in the response of the same request. When the client accepts text/event-stream, the HTTP response is sent as a Server-Sent Events stream with every notification followed by the final result. Over stdio the notifications are written before the response.
logLevel in _meta, and the level of the message is equal to or higher than the requested level.
For 2025-11-25 and older clients the overloads behave like the methods without session: the log level is the one set by the client with logging/setLevel, and the notifications are delivered through the session streams, which requires TransportOptions.HttpStreamable.Enabled.
procedure TMainForm.MCPServerMCPRequestTool(Sender: TObject;
const aSession: TsgcAI_MCP_Session; const aRequest: TsgcAI_MCP_Request_ToolsCall;
const aResponse: TsgcAI_MCP_Response_ToolsCall);
var
i: Integer;
begin
MCPServer.SendLogMessage(aSession, aimcpllInfo, 'import', 'Import started');
for i := 1 to 5 do
begin
ImportChunk(i);
if aRequest.ProgressToken <> '' then
MCPServer.SendNotificationProgress(aSession, aRequest.ProgressToken, i, 5,
Format('Chunk %d of 5', [i]));
end;
MCPServer.SendLogMessage(aSession, aimcpllInfo, 'import', 'Import finished');
aResponse.Result.Content.AddText('5 chunks imported');
end;