spring-projects/spring-ai · info
No elicitation methods found
Error message
No elicitation methods found
What it means
AsyncMcpElicitationProvider scans its provider objects for methods annotated with @McpElicitation and adapts them into elicitation handler specifications. If the collected handler list is empty it logs this warning. It is not an exception: the server just has no elicitation handler registered. The library logs it to flag that elicitation objects were supplied yet yielded no methods matching the expected annotation and async signature.
Source
Thrown at mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/provider/elicitation/AsyncMcpElicitationProvider.java:112
.sorted((m1, m2) -> m1.getName().compareTo(m2.getName()))
.map(mcpElicitationMethod -> {
var elicitationAnnotation = mcpElicitationMethod.getAnnotation(McpElicitation.class);
Function<ElicitRequest, Mono<ElicitResult>> methodCallback = AsyncMcpElicitationMethodCallback
.builder()
.method(mcpElicitationMethod)
.bean(elicitationObject)
.elicitation(elicitationAnnotation)
.build();
return new AsyncElicitationSpecification(elicitationAnnotation.clients(), methodCallback);
})
.toList())
.flatMap(List::stream)
.toList();
if (elicitationHandlers.isEmpty()) {
logger.warn("No elicitation methods found");
}
if (elicitationHandlers.size() > 1) {
if (logger.isWarnEnabled()) {
logger.warn("Multiple elicitation methods found: " + elicitationHandlers.size());
}
}
return elicitationHandlers;
}
/**
* Returns the methods of the given bean class.
* @param bean the bean instance
* @return the methods of the bean class
*/
protected Method[] doGetClassMethods(Object bean) {
return bean.getClass().getDeclaredMethods();
}View on GitHub (pinned to 98a7beda4f)
Solutions
- Annotate exactly one method with @McpElicitation in the object(s) passed to AsyncMcpElicitationProvider, using the async (Mono/Flux-based) signature this provider expects
- Ensure the handler method is declared on the bean's own class, not a superclass or interface
- Use SyncMcpElicitationProvider instead if your handler is synchronous
- If elicitation is not used, remove the elicitation provider/objects from configuration to avoid the warning
Example fix
// before
class MyElicitation { public ElicitResult askUser(String msg) { ... } } // not annotated / sync
// after
class MyElicitation {
@McpElicitation
public Mono<ElicitResult> askUser(ElicitRequest request) { ... }
}
new AsyncMcpElicitationProvider(List.of(new MyElicitation())); Defensive patterns
Strategy: validation
Validate before calling
long found = Arrays.stream(bean.getClass().getDeclaredMethods())
.filter(m -> m.isAnnotationPresent(McpElicitation.class))
.count();
if (found == 0) throw new IllegalStateException("No @McpElicitation handler in " + bean.getClass()); Type guard
static boolean hasElicitationHandler(Object bean) {
return Arrays.stream(bean.getClass().getDeclaredMethods())
.anyMatch(m -> m.isAnnotationPresent(McpElicitation.class));
} Prevention
- Register exactly one elicitation handler bean for the async provider
- Use the sync provider for synchronous handlers and the async provider for Mono/Flux handlers
- Add a startup assertion that elicitation specifications are non-empty when elicitation is required
When it happens
Trigger: getElicitationSpecifications() returns an empty list because no method in the supplied objects is annotated @McpElicitation (or none survives the reactive/async-signature predicates), or no objects were passed at all.
Common situations: Forgetting to annotate the elicitation handler method; annotating a sync handler and passing it to the async provider; methods defined on a parent class (getDeclaredMethods only); client registers elicitation support but the server-side bean was never wired into the provider.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Multiple elicitation methods found: <count>
- No elicitation methods found
- Multiple elicitation methods found: <count>
- No complete methods found in the provided complete objects:
- No prompt methods found in the provided prompt objects: <pro
AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11).
Data as JSON: /api/errors/7935d586f9d0d7e9.
Report an issue: GitHub.