Skip to content

Commit 178f620

Browse files
Copilotstephentoub
andcommitted
Add test to validate client Description from server perspective
Co-authored-by: stephentoub <[email protected]>
1 parent dc178fc commit 178f620

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/ModelContextProtocol.Tests/Client/McpClientTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ public async Task CanReadServerInfo()
7171
Assert.Equal("dark", icon1.Theme);
7272
}
7373

74+
[Fact]
75+
public async Task ServerCanReadClientInfo()
76+
{
77+
var clientOptions = new McpClientOptions
78+
{
79+
ClientInfo = new Implementation
80+
{
81+
Name = "test-client",
82+
Version = "2.0.0",
83+
Description = "A test client for validating client-server communication"
84+
}
85+
};
86+
87+
await using McpClient client = await CreateMcpClientForServer(clientOptions);
88+
89+
// Verify the server received the client info with description
90+
var clientInfo = Server.ClientInfo;
91+
Assert.NotNull(clientInfo);
92+
Assert.Equal("test-client", clientInfo.Name);
93+
Assert.Equal("2.0.0", clientInfo.Version);
94+
Assert.Equal("A test client for validating client-server communication", clientInfo.Description);
95+
}
96+
7497
[Theory]
7598
[InlineData(null, 10)]
7699
[InlineData(0.7f, 50)]

0 commit comments

Comments
 (0)