ClientCapabilitiesBuilder

DSL builder for constructing ClientCapabilities instances.

This builder is used within InitializeRequestBuilder to configure client capabilities. All capabilities are optional - the presence of a capability indicates support for that feature.

Available Functions (all optional)

  • sampling - Indicates support for sampling from an LLM

  • roots - Indicates support for listing roots

  • elicitation - Indicates support for elicitation from the server

  • experimental - Defines experimental, non-standard capabilities

Example usage within buildInitializeRequest:

val request = buildInitializeRequest {
protocolVersion = "1.0"
capabilities {
sampling(ClientCapabilities.sampling)
roots(listChanged = true)
experimental {
put("customFeature", JsonPrimitive(true))
}
}
info("MyClient", "1.0.0")
}

See also

Functions

Link copied to clipboard

Indicates that the client supports elicitation from the server with custom configuration.

Indicates that the client supports elicitation from the server.

Link copied to clipboard

Defines experimental, non-standard capabilities that the client supports using a DSL builder.

Defines experimental, non-standard capabilities that the client supports.

Link copied to clipboard
fun roots(listChanged: Boolean? = null)

Indicates that the client supports listing roots.

Link copied to clipboard
fun sampling(block: JsonObjectBuilder.() -> Unit)

Indicates that the client supports sampling from an LLM with custom configuration.

fun sampling(value: JsonObject)

Indicates that the client supports sampling from an LLM.