handleCreateMessage abstract method

FutureOr<CreateMessageResult> handleCreateMessage(
  1. CreateMessageRequest request,
  2. Implementation serverInfo
)

Handles a request to prompt the LLM from the server.

Must be implemented by clients. According to spec, the client should request approval from a human before sending this prompt to the LLM, as well as before sending the response back to the server.

See https://spec.modelcontextprotocol.io/specification/2024-11-05/client/sampling/#message-flow

The serverInfo is the description that the server initiating this request gave when it was initialized.

Implementation

FutureOr<CreateMessageResult> handleCreateMessage(
  CreateMessageRequest request,
  Implementation serverInfo,
);