What Are MCP Prompt Requests?
In MCP, Prompts are structured templates that clients can discover and use to generate model inputs consistently.
Each MCP server exposes:
-
prompts/list— to enumerate available prompts. -
prompts/get— to render a specific prompt with given arguments. -
notifications/prompts/list_changed— to notify clients when the prompt catalog changes.
This allows large language models or agents to retrieve available templates and render them dynamically with context.
Listing Prompts
When a client calls prompts/list, your server should return an array of prompt definitions, including each prompt's name, description, and argument schema.
Example code that publishes a code review prompt:
procedure TMainForm.FormCreate(Sender: TObject);
var
oPrompt: TsgcAI_MCP_Prompt;
begin
MCPServer.Prompts.Clear;
oPrompt := MCPServer.Prompts.AddPrompt('CodeReview',
'Asks the LLM to analyze code quality and suggest improvements');
oPrompt.Arguments.AddArgument('code', 'The code to review', True);
end;
Prompt Request
When a client issues a prompts.call JSON-RPC request, TsgcWSAPIServer_MCP hydrates the strongly-typed request object (including tool name and the provided arguments) before raising the OnMCPRequestPrompt event. Your handler populates the response payload which is then serialized back to the client, alongside a success HTTP status code.
A typical handler looks like this:
procedure TFRMMCPServer.MCPServerMCPRequestPrompt(Sender: TObject;
const aSession: TsgcAI_MCP_Session; const aRequest: TsgcAI_MCP_Request_PromptsGet;
const aResponse: TsgcAI_MCP_Response_PromptsGet);
begin
if aRequest.Params.Name = 'CodeReview' then
begin
aResponse.Result.Description := 'Code review prompt';
aResponse.Result.Messages.AddText('user',
'Please review this Delphi code: ShowMessage(''Hello World'' ');
end;
end;
With MCP Prompts now integrated into sgcWebSockets 2025.9.0, developers can create AI-aware WebSocket servers that expose structured, discoverable, and dynamic prompts — bridging the gap between LLMs and real-time application data.
Learn More
For in-depth documentation and component reference, visit:
sgcWebSockets MCP Prompts Server Guide
Find below a Delphi MCP Server Demo for Windows