Skip to content

Adding a prompt with a name that is taken causes a server crash #440

@johnsonr

Description

@johnsonr

While this may be invalid usage, it definitely should not crash the server.

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
18:50:18.060 [main] ERROR SpringApplication - Application run failed
io.modelcontextprotocol.spec.McpError: Prompt with name 'com.embabel.example.horoscope.StarNewsFinder.writeup' already exists
	at io.modelcontextprotocol.server.McpAsyncServer.lambda$addPrompt$27(McpAsyncServer.java:508)
	at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:45)
	at reactor.core.publisher.Mono.subscribe(Mono.java:4576)
	at reactor.core.publisher.Mono.block(Mono.java:1778)
	at io.modelcontextprotocol.server.McpSyncServer.addPrompt(McpSyncServer.java:103)
	at com.embabel.agent.mcpserver.McpSyncServerConfiguration.exposeMcpPrompts(McpSyncServerConfiguration.kt:166)
	at com.embabel.agent.mcpserver.McpSyncServerConfiguration.exposeMcpFunctionality(McpSyncServerConfiguration.kt:92)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:382)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:254)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:173)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:454)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:387)
	at com.embabel.agent.spi.support.DelegatingAgentScanningBeanPostProcessor.onApplicationEvent(AutoRegistration.kt:106)
	at com.embabel.agent.spi.support.DelegatingAgentScanningBeanPostProcessor.onApplicationEvent(AutoRegistration.kt:80)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:454)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:387)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:1009)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:630)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:318)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350)
	at com.embabel.example.AgentMcpServerApplication.main(AgentMcpServerApplication.java:53)
	Suppressed: java.lang.Exception: #block terminated with an error
		at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:104)
		at reactor.core.publisher.Mono.block(Mono.java:1779)
		... 29 common frames omitted
18:50:18.146 [ForkJoinPool.commonPool-worker-1] WARN  StdioClientTransport - Process terminated with code 255

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions