ToolParameter

@Serializable
data class ToolParameter(val name: String, val description: String, val type: ParameterType, val required: Boolean = false, val itemsType: ParameterType? = null, val enumValues: List<String>? = null, val minimum: Double? = null, val maximum: Double? = null)

A single declared input to an McpTool. The list of these on a tool is compiled into the inputSchema advertised by MCP tools/list, so name and type are part of the wire contract.

Constructors

Link copied to clipboard
constructor(name: String, description: String, type: ParameterType, required: Boolean = false, itemsType: ParameterType? = null, enumValues: List<String>? = null, minimum: Double? = null, maximum: Double? = null)

Properties

Link copied to clipboard

Human/LLM-readable explanation of the argument.

Link copied to clipboard

The only accepted values, emitted as the schema's enum (for arrays, on items). Advisory — tools still validate their own input.

Link copied to clipboard

Element type for ParameterType.ARRAY parameters, emitted as the schema's items. When null an array still gets an unconstrained "items": {} — some clients (Gemini/OpenAI-compatible bridges) reject array schemas with no items at all.

Link copied to clipboard

Inclusive upper bound, emitted as maximum.

Link copied to clipboard

Inclusive lower bound for ParameterType.INTEGER / ParameterType.NUMBER, emitted as minimum. Use it to advertise the range the tool clamps to.

Link copied to clipboard

Argument key the caller supplies and McpTool.execute reads from its params map.

Link copied to clipboard

Whether the argument must be present. Surfaced in the enclosing schema's required array by the protocol layer (not by toJsonSchema, which describes one property).

Link copied to clipboard

JSON Schema type of the value.

Functions

Link copied to clipboard

The JSON Schema fragment for this one parameter — { "type": ..., "description": ... }, plus items for arrays, enum, and minimum/maximum when declared. Required-ness is intentionally omitted here; the protocol layer aggregates it into the parent object schema's required list.