{"record":{"id":"95d9e6c1935fc04f","repo":"spring-projects/spring-ai","slug":"no-prompt-methods-found-in-the-provided-prompt-obj-95d9e6","errorCode":null,"errorMessage":"No prompt methods found in the provided prompt objects: <promptObjects>","messagePattern":"No prompt methods found in the provided prompt objects: <promptObjects>","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/provider/prompt/AsyncStatelessMcpPromptProvider.java","lineNumber":94,"sourceCode":"\t\t\t\t\tvar promptAnnotation = mcpPromptMethod.getAnnotation(McpPrompt.class);\n\t\t\t\t\tvar mcpPrompt = PromptAdapter.asPrompt(promptAnnotation, mcpPromptMethod);\n\n\t\t\t\t\tBiFunction<McpTransportContext, GetPromptRequest, Mono<GetPromptResult>> methodCallback = AsyncStatelessMcpPromptMethodCallback\n\t\t\t\t\t\t.builder()\n\t\t\t\t\t\t.method(mcpPromptMethod)\n\t\t\t\t\t\t.bean(promptObject)\n\t\t\t\t\t\t.prompt(mcpPrompt)\n\t\t\t\t\t\t.build();\n\n\t\t\t\t\treturn new AsyncPromptSpecification(mcpPrompt, methodCallback);\n\t\t\t\t})\n\t\t\t\t.toList())\n\t\t\t.flatMap(List::stream)\n\t\t\t.toList();\n\n\t\tif (promptSpecs.isEmpty()) {\n\t\t\tif (logger.isWarnEnabled()) {\n\t\t\t\tlogger.warn(\"No prompt methods found in the provided prompt objects: \" + this.promptObjects);\n\t\t\t}\n\t\t}\n\n\t\treturn promptSpecs;\n\t}\n\n\t/**\n\t * Returns the methods of the given bean class.\n\t * @param bean the bean instance\n\t * @return the methods of the bean class\n\t */\n\tprotected Method[] doGetClassMethods(Object bean) {\n\t\treturn bean.getClass().getDeclaredMethods();\n\t}\n\n}\n","sourceCodeStart":76,"sourceCodeEnd":111,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/provider/prompt/AsyncStatelessMcpPromptProvider.java#L76-L111","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nnew AsyncStatelessMcpPromptProvider(List.of(new PromptBean()));\n\n// after\nclass PromptBean {\n    @McpPrompt(name = \"summary\")\n    public PromptSpec summary(McpTransportContext ctx, @McpPromptParam String text) { ... }\n}\nnew AsyncStatelessMcpPromptProvider(List.of(new PromptBean()));","handlingStrategy":"validation","validationCode":"if (Arrays.stream(bean.getClass().getDeclaredMethods())\n        .noneMatch(m -> m.isAnnotationPresent(McpPrompt.class))) {\n    throw new IllegalStateException(\"No @McpPrompt methods in \" + bean.getClass());\n}","typeGuard":"static boolean hasStatelessPromptMethods(Object bean) {\n    return Arrays.stream(bean.getClass().getDeclaredMethods())\n        .anyMatch(m -> m.isAnnotationPresent(McpPrompt.class));\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["mcp","spring-ai","annotation-scanning","prompt"],"backgroundTag":"empty-result-set","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}