Didier Villevalois
04/10/2026, 3:44 PMMcpToolDescriptorParser that supports type attributes with nullable primitives represented like ["string", "null"] (as generated by kotlinx-schema).
So I am trying to transform it to an ToolParameterType.AnyOf, though I am confused because ToolParameterType.AnyOf(...) takes an array of ToolParameterDescriptor for the union types. And ToolParameterDescriptor, requires a title and description which seems incorrect to me as these are supposed to be only types and not parameters. So I believe it should rather take an array of ToolParameterType. Am I right?
Also there is a TODO in front of the ToolParameterDescriptor class definition:
// FIXME ToolParameterDescriptor.name in types array is actually always ignored when the schema is constructed.
// Should we use a dedicated type here instead?
I would love guidance here, please.Anastasiia Zarechneva
04/10/2026, 4:37 PMDidier Villevalois
04/10/2026, 4:45 PMDidier Villevalois
04/10/2026, 5:32 PMMcpToolDescriptorParser but all the agents and llm client API depends on ToolDescriptor. What bugs me is that ToolDescriptor s are then used to generate Json again in llm clients...
Shouldn't we completely remove those ToolDescriptor s and work with MCP SDK's input and output ToolSchema directly?Maria Tigina
04/10/2026, 5:44 PMToolParameterDescriptor(
name = "discount",
description = "Discount for token, can be Double or Null",
type = ToolParameterType.AnyOf(
types = arrayOf(
ToolParameterDescriptor(
name = "discount",
description = "Price for token, can be, Double option",
type = ToolParameterType.Float
),
ToolParameterDescriptor(
name = "discount",
description = "Price for token, can be, Null option",
type = ToolParameterType.Null
)
)
)
),Maria Tigina
04/10/2026, 5:51 PMDidier Villevalois
04/10/2026, 5:54 PMToolParameterDescriptor should I generate for "type": ["string", "null"] ?
I really believe forcing a description and a name for the members of a union makes little sense.Didier Villevalois
04/10/2026, 5:55 PMkotlinx-schema 0.5.0 to generate the tool schemas.Didier Villevalois
04/10/2026, 5:58 PMname and description for now... But I think ToolParameterDescriptor is broken when compared to what MCP allows.Maria Tigina
04/10/2026, 6:01 PMDidier Villevalois
04/10/2026, 6:05 PMToolDescriptor for good and use kotlinx-schema representations?Maria Tigina
04/10/2026, 6:06 PMDidier Villevalois
04/10/2026, 6:06 PM