TsgcWSAPIClient_MCP › Events › OnMCPElicitationCreate
Fires when the server asks the user for additional input (elicitation/create).
property OnMCPElicitationCreate: TsgcAI_MCP_Client_OnElicitationCreateEvent;
// TsgcAI_MCP_Client_OnElicitationCreateEvent = procedure(Sender: TObject; const aRequest: TsgcAI_MCP_Request_ElicitationCreate; const aResponse: TsgcAI_MCP_Response_ElicitationCreate) of object
—
Server-initiated event: the server wants the host to collect structured information from the end user. aRequest.Params.Message is the prompt to display and aRequest.Params.RequestedSchema is the JSON Schema describing the expected answer shape. Present a form or dialog to the user, then fill aResponse.Result.Action (accept, decline, or cancel) and the matching aResponse.Result.Content payload before the handler returns. The component posts the reply to the server automatically.
procedure TMainForm.MCPElicitationCreate(Sender: TObject;
const aRequest: TsgcAI_MCP_Request_ElicitationCreate;
const aResponse: TsgcAI_MCP_Response_ElicitationCreate);
var
vInput: string;
begin
if InputQuery('MCP server', aRequest.Params.Message, vInput) then
begin
aResponse.Result.Action := 'accept';
aResponse.Result.Content.AddPair('value', vInput);
end
else
aResponse.Result.Action := 'cancel';
end;