{"record":{"id":"16657e9038366537","repo":"spring-projects/spring-ai","slug":"no-prompt-methods-found-in-the-provided-prompt-obj","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/AsyncMcpPromptProvider.java","lineNumber":93,"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<McpAsyncServerExchange, GetPromptRequest, Mono<GetPromptResult>> methodCallback = AsyncMcpPromptMethodCallback\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":75,"sourceCodeEnd":110,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/mcp/mcp-annotations/src/main/java/org/springframework/ai/mcp/annotation/provider/prompt/AsyncMcpPromptProvider.java#L75-L110","documentation":"AsyncMcpPromptProvider scans the supplied promptObjects for @McpPrompt-annotated methods with async signatures and converts them into prompt specifications. When none qualify it logs this warning naming the objects scanned. No exception is raised; the server just exposes no prompts. The warning is the library's way of signaling a probable misconfiguration (objects registered but no prompt methods found).","triggerScenarios":"getPromptSpecifications() produces an empty list because no method in promptObjects is annotated @McpPrompt or none passes the provider's filters (e.g. reactive-return-type filtering mismatched with the provider type, methods in superclasses, or an empty object list).","commonSituations":"Forgetting @McpPrompt on prompt methods; passing prompt beans to the wrong sync/async provider variant; prompt methods declared in a base class; auto-configuration registering prompt objects that were never implemented.","solutions":["Ensure at least one method in each prompt object is annotated @McpPrompt with a signature matching the async provider's predicates","Move annotated methods into the concrete class (only getDeclaredMethods is scanned)","Use the sync prompt provider variants for synchronous prompt methods","Remove the promptObjects registration if prompts are not used"],"exampleFix":"// before\nnew AsyncMcpPromptProvider(List.of(new Prompts())); // no @McpPrompt methods\n\n// after\nclass Prompts {\n    @McpPrompt(name = \"greeting\", description = \"Greeting prompt\")\n    public PromptSpec greet(String name) { ... }\n}\nnew AsyncMcpPromptProvider(List.of(new Prompts()));","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 hasPromptMethods(Object bean) {\n    return Arrays.stream(bean.getClass().getDeclaredMethods())\n        .anyMatch(m -> m.isAnnotationPresent(McpPrompt.class));\n}","tryCatchPattern":null,"preventionTips":["Register prompt objects only after prompt methods are implemented","Keep @McpPrompt methods on the concrete class","Choose the sync or async prompt provider to match method return types"],"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"}