spring-projects/spring-ai · info
No prompt methods found in the provided prompt objects: <pro
Error message
No prompt methods found in the provided prompt objects: <promptObjects>
What it means
AsyncStatelessMcpPromptProvider builds stateless prompt specifications from @McpPrompt-annotated methods in the supplied objects. If the specification list is empty it logs this warning including the scanned objects. Nothing is thrown; the server simply has no prompt features. It indicates a likely mismatch between the registered objects and the annotation or signature expectations.
Source
Thrown at mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/provider/prompt/AsyncStatelessMcpPromptProvider.java:94
var promptAnnotation = mcpPromptMethod.getAnnotation(McpPrompt.class);
var mcpPrompt = PromptAdapter.asPrompt(promptAnnotation, mcpPromptMethod);
BiFunction<McpTransportContext, GetPromptRequest, Mono<GetPromptResult>> methodCallback = AsyncStatelessMcpPromptMethodCallback
.builder()
.method(mcpPromptMethod)
.bean(promptObject)
.prompt(mcpPrompt)
.build();
return new AsyncPromptSpecification(mcpPrompt, methodCallback);
})
.toList())
.flatMap(List::stream)
.toList();
if (promptSpecs.isEmpty()) {
if (logger.isWarnEnabled()) {
logger.warn("No prompt methods found in the provided prompt objects: " + this.promptObjects);
}
}
return promptSpecs;
}
/**
* 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 at least one method with @McpPrompt in the supplied objects with a signature matching the stateless async provider
- Move @McpPrompt methods out of superclasses/interfaces into the bean class
- Verify you are using the correct sync/async and stateful/stateless provider variant for your method signatures
- Drop the prompt provider from configuration when no prompts are intended
Example fix
// before
new AsyncStatelessMcpPromptProvider(List.of(new PromptBean()));
// after
class PromptBean {
@McpPrompt(name = "summary")
public PromptSpec summary(McpTransportContext ctx, @McpPromptParam String text) { ... }
}
new AsyncStatelessMcpPromptProvider(List.of(new PromptBean())); Defensive patterns
Strategy: validation
Validate before calling
if (Arrays.stream(bean.getClass().getDeclaredMethods())
.noneMatch(m -> m.isAnnotationPresent(McpPrompt.class))) {
throw new IllegalStateException("No @McpPrompt methods in " + bean.getClass());
} Type guard
static boolean hasStatelessPromptMethods(Object bean) {
return Arrays.stream(bean.getClass().getDeclaredMethods())
.anyMatch(m -> m.isAnnotationPresent(McpPrompt.class));
} Prevention
- Confirm the stateless provider variant matches stateless method signatures (e.g. McpTransportContext params)
- Add a smoke test that asserts promptSpecs is non-empty when prompts are required
- Remove placeholder beans from provider configuration
When it happens
Trigger: getPromptSpecifications() returns an empty list: no @McpPrompt methods exist in promptObjects, or none pass the signature/type filters (e.g. reactive methods vs expected stateless signatures, methods on superclasses, empty list of objects).
Common situations: Prompt methods not yet written while scaffolding the server; wrong provider variant for the method style; annotations placed on interface methods; beans not actually containing prompt logic after refactoring.
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
- No prompt methods found in the provided prompt objects: <pro
- No prompt methods found in the provided prompt objects: <pro
- No complete methods found in the provided complete objects:
- No elicitation methods found
- Multiple elicitation methods found: <count>
AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11).
Data as JSON: /api/errors/95d9e6c1935fc04f.
Report an issue: GitHub.