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
SyncStatelessMcpPromptProvider scans promptObjects for @McpPrompt methods with synchronous, stateless-compatible signatures and produces prompt specifications. When none are found it logs this warning listing the objects; it does not throw. The warning flags that registered prompt objects yielded zero usable prompt methods, usually a wiring or annotation mistake.
Source
Thrown at mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/provider/prompt/SyncStatelessMcpPromptProvider.java:93
var promptAnnotation = mcpPromptMethod.getAnnotation(McpPrompt.class);
var mcpPrompt = PromptAdapter.asPrompt(promptAnnotation, mcpPromptMethod);
BiFunction<McpTransportContext, GetPromptRequest, GetPromptResult> methodCallback = SyncStatelessMcpPromptMethodCallback
.builder()
.method(mcpPromptMethod)
.bean(promptObject)
.prompt(mcpPrompt)
.build();
return new SyncPromptSpecification(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
- Add a method annotated @McpPrompt with a sync signature to one of the supplied objects
- Use the async prompt provider if methods return Mono/Flux
- Move annotated methods into the concrete bean class
- Remove promptObjects from the provider when prompts are not used
Example fix
// before
class MyPrompts { }
// after
class MyPrompts {
@McpPrompt(name = "code-review")
public PromptSpec codeReview(@McpPromptParam String code) { ... }
}
new SyncStatelessMcpPromptProvider(List.of(new MyPrompts())); 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 hasSyncPromptMethods(Object bean) {
return Arrays.stream(bean.getClass().getDeclaredMethods())
.anyMatch(m -> m.isAnnotationPresent(McpPrompt.class));
} Prevention
- Use async providers for Mono/Flux prompt methods
- Keep annotated prompt methods in the registered bean class itself
- Assert prompt specification counts in startup tests
When it happens
Trigger: getPromptSpecifications() yields an empty list: no @McpPrompt annotation present, predicate filters reject all methods (reactive return type, wrong parameters), methods reside in superclasses, or promptObjects is empty.
Common situations: Scaffolding a stateless MCP server before implementing prompts; passing beans whose prompt methods return Mono/Flux to the sync provider; annotated methods in base classes; config classes registering placeholder objects.
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/4bf38646f69f626f.
Report an issue: GitHub.