TsgcWSAPIServer_MCP › Events › OnMCPRequestPrompt
Raised when a client issues prompts/get; fill the messages returned for that prompt template.
property OnMCPRequestPrompt: TsgcAI_MCP_Server_OnRequestPromptEvent;
// TsgcAI_MCP_Server_OnRequestPromptEvent = procedure(Sender: TObject; const aSession: TsgcAI_MCP_Session; const aRequest: TsgcAI_MCP_Request_PromptsGet; const aResponse: TsgcAI_MCP_Response_PromptsGet) of object
—
Fires when the client calls prompts/get with a template name (and optional arguments). aRequest.Params.Name selects the prompt, aRequest.Params.Arguments carries the substitutions. Populate aResponse.Result.Description and append the rendered conversation to aResponse.Result.Messages (system/user/assistant turns). The matching entry from the Prompts catalogue is available through MCPServer.Prompts if you want to reuse its metadata.
procedure TMainForm.MCPServerMCPRequestPrompt(Sender: TObject;
const aSession: TsgcAI_MCP_Session; const aRequest: TsgcAI_MCP_Request_PromptsGet;
const aResponse: TsgcAI_MCP_Response_PromptsGet);
begin
if SameText(aRequest.Params.Name, 'ops.plan-template') then
begin
aResponse.Result.Description := 'Remediation checklist';
aResponse.Result.Messages.Clear;
aResponse.Result.Messages.AddText('assistant', 'Review deployment ' +
aRequest.Params.Arguments.Node['deploymentId'].AsString);
end;
end;