-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Spring AI 1.1
I have:
record UserRandomNumber(int number) { }
@McpTool(description = "generate a random number")
public int random(McpSyncRequestContext context) {
Random rand = new Random();
Integer maybeNumber = null;
if (rand.nextBoolean() && context.elicitEnabled()) {
var elicitResult = context.elicit(UserRandomNumber.class);
if (elicitResult.action() == McpSchema.ElicitResult.Action.ACCEPT) {
maybeNumber = elicitResult.structuredContent().number();
}
}
return maybeNumber != null ? maybeNumber : rand.nextInt(100);
}
In MCP Inspector when I provide the elicited value I get:
Validation Error: unknown format "int32" is used in schema at path "#/properties/number"