From 68faa5123505273d3446170dfab644226a1e84d6 Mon Sep 17 00:00:00 2001 From: Pavel Gorgulov Date: Wed, 26 Mar 2025 12:31:22 +0100 Subject: [PATCH] Remove CompletableDeferred (#57) Co-authored-by: Leonid Stashevsky --- .../modelcontextprotocol/sample/server/McpWeatherServer.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt b/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt index 9e26d23..e3f56f3 100644 --- a/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt +++ b/samples/weather-stdio-server/src/main/kotlin/io/modelcontextprotocol/sample/server/McpWeatherServer.kt @@ -10,7 +10,6 @@ import io.modelcontextprotocol.kotlin.sdk.* import io.modelcontextprotocol.kotlin.sdk.server.Server import io.modelcontextprotocol.kotlin.sdk.server.ServerOptions import io.modelcontextprotocol.kotlin.sdk.server.StdioServerTransport -import kotlinx.coroutines.CompletableDeferred import kotlinx.coroutines.Job import kotlinx.coroutines.runBlocking import kotlinx.io.asSink @@ -19,8 +18,6 @@ import kotlinx.serialization.json.* // Main function to run the MCP server fun `run mcp server`() { - val def = CompletableDeferred() - // Base URL for the Weather API val baseUrl = "https://api.weather.gov" @@ -52,7 +49,7 @@ fun `run mcp server`() { ServerOptions( capabilities = ServerCapabilities(tools = ServerCapabilities.Tools(listChanged = true)) ) - ) { def.complete(Unit) } + ) // Register a tool to fetch weather alerts by state server.addTool(