TsgcWSAPIServer_MCPEvents › OnMCPSessionNew

OnMCPSessionNew Event

Raised every time a new MCP session is created.

Syntax

property OnMCPSessionNew: TsgcAI_MCP_Server_OnSessionNewEvent;
// TsgcAI_MCP_Server_OnSessionNewEvent = procedure(Sender: TObject; const aSession: TsgcAI_MCP_Session) of object

Default Value

Remarks

Fires the first time the server sees a client’s Mcp-Session-Id header or, when missing, when a new session record is added on the fly. Use it to allocate per-session caches, emit audit entries, or attach application-specific state to aSession. The session is already registered in MCPServer.Sessions when the event fires.

Example

procedure TMainForm.MCPServerMCPSessionNew(Sender: TObject;
  const aSession: TsgcAI_MCP_Session);
begin
  MemoLog.Lines.Add('#session_new ' + aSession.Id);
end;

Back to Events