TsgcWSAPIServer_MCP › Events › OnMCPInitialize
Fired during the MCP handshake so server capabilities and ServerInfo can be customised per session.
property OnMCPInitialize: TsgcAI_MCP_Server_OnInitializeEvent;
// TsgcAI_MCP_Server_OnInitializeEvent = procedure(Sender: TObject; const aRequest: TsgcAI_MCP_Request_Initialize; const aResponse: TsgcAI_MCP_Response_Initialize) of object
—
Raised after the initialize request has been parsed and just before the negotiated response is returned to the client. Inspect aRequest to read the protocol version and the capabilities announced by the client, and mutate aResponse to customise the ServerInfo, advertise extra capabilities (Tools, Prompts, Resources, Logging, Completions, Sampling, Elicitation) or adjust the instructions shown to the client. Perform only non-blocking work here; long operations should be deferred to later lifecycle events.
procedure TMainForm.MCPServerMCPInitialize(Sender: TObject;
const aRequest: TsgcAI_MCP_Request_Initialize;
const aResponse: TsgcAI_MCP_Response_Initialize);
begin
aResponse.Result.ServerInfo.Name := 'sgc-mcp-server';
aResponse.Result.ServerInfo.Version := '1.0.0';
aResponse.Result.Instructions := 'Authenticated MCP server for operations workflows.';
end;