@@ -473,13 +473,32 @@ class ServerTest {
473473 assertEquals(" Server does not support resources capability." , exception.message)
474474 }
475475
476+ @Test
477+ fun `Server constructor should accept instructions provider parameter` () = runTest {
478+ val serverInfo = Implementation (name = " test server" , version = " 1.0" )
479+ val serverOptions = ServerOptions (capabilities = ServerCapabilities ())
480+ val instructions = " This is a test server. Use it for testing purposes only."
481+
482+ val server = Server (serverInfo, serverOptions, { instructions })
483+
484+ // The instructions should be stored internally and used in handleInitialize
485+ // We can't directly access the private field, but we can test it through initialization
486+ val (clientTransport, serverTransport) = InMemoryTransport .createLinkedPair()
487+ val client = Client (clientInfo = Implementation (name = " test client" , version = " 1.0" ))
488+
489+ server.connect(serverTransport)
490+ client.connect(clientTransport)
491+
492+ assertEquals(instructions, client.serverInstructions)
493+ }
494+
476495 @Test
477496 fun `Server constructor should accept instructions parameter` () = runTest {
478497 val serverInfo = Implementation (name = " test server" , version = " 1.0" )
479498 val serverOptions = ServerOptions (capabilities = ServerCapabilities ())
480499 val instructions = " This is a test server. Use it for testing purposes only."
481500
482- val server = Server (serverInfo, serverOptions) { instructions }
501+ val server = Server (serverInfo, serverOptions, instructions)
483502
484503 // The instructions should be stored internally and used in handleInitialize
485504 // We can't directly access the private field, but we can test it through initialization
0 commit comments