Odisseia 1.21.56
Português do BrasilManual oficial · 1.21.56
Sobre a tradução em inglês

TMCPServer.Prompt#

Registra um callback retido para um prompt nomeado.

Declaração#

procedure Prompt(const Name: String; Handler: callback(const Context: TMCPCallContext; const ArgumentsJson: String): String);

Exemplo#

uses Odisseia.Mcp;
function Greeting(const Context: TMCPCallContext; const ArgumentsJson: String): String;
begin Result := '{"messages":[{"role":"user","content":"Olá"}]}' end;
var Server: TMCPServer;
begin
  Server := TMCPServer.Create;
  Server.Transport('inprocess');
  Server.Endpoint('mcp-local');
  Server.Prompt('greeting', Greeting);
  Server.Start
end.

O handler recebe os argumentos como JSON e deve devolver JSON válido. Requer mcp.server.use e mcp.server.prompt.