Package io.quarkiverse.mcp.server
Interface SamplingRequest
- All Known Implementing Classes:
SamplingRequestImpl
public interface SamplingRequest
A request from the server to sample an LLM.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic enumA request to include context from one or more MCP servers. -
Method Summary
Modifier and TypeMethodDescriptionlongmessages()metadata()io.smallrye.mutiny.Uni<SamplingResponse>send()Send a message to the client.default SamplingResponseSend a message to the client and wait for the result.
-
Method Details
-
maxTokens
long maxTokens()- Returns:
- the maximum number of tokens to sample
-
messages
List<SamplingMessage> messages()- Returns:
- the sampling messages (not
null)
-
stopSequences
- Returns:
- the stop sequences
-
systemPrompt
String systemPrompt()- Returns:
- the system prompt the server wants to use for sampling
-
temperature
BigDecimal temperature()- Returns:
- the temperature
-
includeContext
SamplingRequest.IncludeContext includeContext()- Returns:
- the request to include the context
-
modelPreferences
ModelPreferences modelPreferences()- Returns:
- the model preferences
-
metadata
- Returns:
- the optional metadata
-
send
Send a message to the client.If the client does not respond before the timeout expires then the returned
Unifails withTimeoutException. The default timeout is configured with thequarkus.mcp.server.sampling.default-timeoutconfig property.- Returns:
- a new
Unithat completes with aSamplingResponse
-
sendAndAwait
Send a message to the client and wait for the result.Note that this method will block until the client sends the response.
If the client does not respond before the timeout expires then a
TimeoutExceptionis thrown. The default timeout is configured with thequarkus.mcp.server.sampling.default-timeoutconfig property.- Returns:
- the response
-