TsgcWSAPIServer_MCPMethods › RequestElicitationCreate

RequestElicitationCreate Method

Sends an elicitation/create request asking the client to collect structured input from the user.

Syntax

function RequestElicitationCreate(const aSessionId: string; const aRequest: TsgcAI_MCP_Request_ElicitationCreate): Boolean;

Parameters

NameTypeDescription
aSessionIdconst stringIdentifier of the target MCP session.
aRequestconst TsgcAI_MCP_Request_ElicitationCreateRequest object carrying the prompt Message shown to the user and the JSON RequestedSchema that describes the expected input.

Return Value

Returns True when the request has been written to the client connection; False when the session is unknown or offline. (Boolean)

Remarks

Triggers an elicitation/create exchange so the client can open a UI, collect values matching the supplied JSON schema, and return them back to the server. The outcome is delivered asynchronously through OnMCPResponseElicitationCreate, where the Action field reports whether the user submitted (accept), skipped (decline) or cancelled the dialog. Use it to ask for missing arguments before completing a tool call.

Example

var
  oRequest: TsgcAI_MCP_Request_ElicitationCreate;
begin
  oRequest := TsgcAI_MCP_Request_ElicitationCreate.Create;
  try
    oRequest.Params.Message := 'Please provide the deployment identifier.';
    oRequest.Params.RequestedSchema.Properties.AddProperty('deploymentId', True, aimcpjtString, 'CI/CD deployment id');
    MCPServer.RequestElicitationCreate(SessionId, oRequest);
  finally
    oRequest.Free;
  end;
end;

Back to Methods