RequestMetaBuilder

DSL builder for constructing RequestMeta instances.

This builder creates metadata for MCP requests, supporting progress tokens and custom key-value pairs.

Example:

meta {
progressToken("progress-123")
put("requestId", "req-456")
put("priority", 1)
putJsonObject("context") {
put("source", "api")
}
}

See also

Functions

Link copied to clipboard
fun progressToken(value: Int)

Sets the progress token as an Int.

fun progressToken(value: Long)

Sets the progress token as a Long.

fun progressToken(value: String)

Sets the progress token as a string.

Link copied to clipboard
fun put(key: String, value: Boolean): JsonElement?

Adds a custom metadata field with a Boolean value.

fun put(key: String, value: Nothing?): JsonElement?

Adds a custom metadata field with a null value.

fun put(key: String, value: Number): JsonElement?

Adds a custom metadata field with a Number value.

fun put(key: String, value: String): JsonElement?

Adds a custom metadata field with a String value.

fun put(key: String, value: JsonElement): JsonElement?

Adds a custom metadata field with a JsonElement value.

Link copied to clipboard
fun putJsonArray(key: String, builderAction: JsonArrayBuilder.() -> Unit): JsonElement?

Adds a custom metadata field with a JsonArray value using a DSL builder.

Link copied to clipboard
fun putJsonObject(key: String, builderAction: JsonObjectBuilder.() -> Unit): JsonElement?

Adds a custom metadata field with a JsonObject value using a DSL builder.