Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Pinned npm dependencies for MCP C# SDK integration and conformance tests",
"dependencies": {
"@modelcontextprotocol/conformance": "0.1.13",
"@modelcontextprotocol/server-everything": "2025.12.18",
"@modelcontextprotocol/server-everything": "2026.1.26",
"@modelcontextprotocol/server-memory": "2026.1.26"
}
}
71 changes: 44 additions & 27 deletions tests/ModelContextProtocol.TestServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ private static void ConfigureTools(McpServerOptions options, string? cliArg)
},
new Tool
{
Name = "sampleLLM",
Description = "Samples from an LLM using MCP's sampling feature.",
Name = "trigger-sampling-request",
Description = "Trigger a Request from the Server for LLM Sampling",
InputSchema = JsonElement.Parse("""
{
"type": "object",
Expand Down Expand Up @@ -205,15 +205,15 @@ private static void ConfigureTools(McpServerOptions options, string? cliArg)
Content = [new TextContentBlock { Text = request.Server.SessionId ?? string.Empty }]
};
}
else if (request.Params?.Name == "sampleLLM")
else if (request.Params?.Name == "trigger-sampling-request")
{
if (request.Params?.Arguments is null ||
!request.Params.Arguments.TryGetValue("prompt", out var prompt) ||
!request.Params.Arguments.TryGetValue("maxTokens", out var maxTokens))
{
throw new McpProtocolException("Missing required arguments 'prompt' and 'maxTokens'", McpErrorCode.InvalidParams);
}
var sampleResult = await request.Server.SampleAsync(CreateRequestSamplingParams(prompt.ToString(), "sampleLLM", Convert.ToInt32(maxTokens.GetRawText())),
var sampleResult = await request.Server.SampleAsync(CreateRequestSamplingParams(prompt.ToString(), "trigger-sampling-request", Convert.ToInt32(maxTokens.GetRawText())),
cancellationToken: cancellationToken);

return new CallToolResult
Expand Down Expand Up @@ -257,28 +257,48 @@ private static void ConfigurePrompts(McpServerOptions options)
Prompts = [
new Prompt
{
Name = "simple_prompt",
Name = "simple-prompt",
Description = "A prompt without arguments"
},
new Prompt
{
Name = "complex_prompt",
Name = "args-prompt",
Description = "A prompt with arguments",
Arguments =
[
new PromptArgument
{
Name = "temperature",
Description = "Temperature setting",
Name = "city",
Description = "Name of the city",
Required = true
},
new PromptArgument
{
Name = "style",
Description = "Output style",
Name = "state",
Description = "Name of the state",
Required = false
}
]
},
new Prompt
{
Name = "completable-prompt",
Description = "A prompt with completable arguments",
Arguments =
[
new PromptArgument
{
Name = "department",
Description = "Choose the department",
Required = true
},
new PromptArgument
{
Name = "name",
Description = "Choose a team member",
Required = true
}
]
}
]
};
Expand All @@ -287,36 +307,33 @@ private static void ConfigurePrompts(McpServerOptions options)
options.Handlers.GetPromptHandler = async (request, cancellationToken) =>
{
List<PromptMessage> messages = [];
if (request.Params?.Name == "simple_prompt")
if (request.Params?.Name == "simple-prompt")
{
messages.Add(new PromptMessage
{
Role = Role.User,
Content = new TextContentBlock { Text = "This is a simple prompt without arguments." },
});
}
else if (request.Params?.Name == "complex_prompt")
else if (request.Params?.Name == "args-prompt")
{
string temperature = request.Params.Arguments?["temperature"].ToString() ?? "unknown";
string style = request.Params.Arguments?["style"].ToString() ?? "unknown";
string city = request.Params.Arguments?["city"].ToString() ?? "unknown";
string state = request.Params.Arguments?["state"].ToString() ?? "";
string location = !string.IsNullOrEmpty(state) ? $"{city}, {state}" : city;
messages.Add(new PromptMessage
{
Role = Role.User,
Content = new TextContentBlock { Text = $"This is a complex prompt with arguments: temperature={temperature}, style={style}" },
});
messages.Add(new PromptMessage
{
Role = Role.Assistant,
Content = new TextContentBlock { Text = "I understand. You've provided a complex prompt with temperature and style arguments. How would you like me to proceed?" },
Content = new TextContentBlock { Text = $"What's weather in {location}?" },
});
}
else if (request.Params?.Name == "completable-prompt")
{
string department = request.Params.Arguments?["department"].ToString() ?? "unknown";
string name = request.Params.Arguments?["name"].ToString() ?? "unknown";
messages.Add(new PromptMessage
{
Role = Role.User,
Content = new ImageContentBlock
{
Data = MCP_TINY_IMAGE,
MimeType = "image/png"
}
Content = new TextContentBlock { Text = $"Please promote {name} to the head of the {department} team." },
});
}
else
Expand Down Expand Up @@ -516,8 +533,8 @@ private static void ConfigureCompletions(McpServerOptions options)
List<string> sampleResourceIds = ["1", "2", "3", "4", "5"];
Dictionary<string, List<string>> exampleCompletions = new()
{
{"style", ["casual", "formal", "technical", "friendly"]},
{"temperature", ["0", "0.5", "0.7", "1.0"]},
{"department", ["Engineering", "Sales", "Marketing", "Support"]},
{"name", ["Alice", "Bob", "Charlie"]},
};

options.Handlers.CompleteHandler = async (request, cancellationToken) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ClientIntegrationTestFixture

public ClientIntegrationTestFixture()
{
const string ServerEverythingVersion = "2025.12.18";
const string ServerEverythingVersion = "2026.1.26";

EverythingServerTransportOptions = new()
{
Expand Down
Loading