Skip to content

Commit 061316b

Browse files
committed
Handling complex prompt properly
It's not the best handler, but modelcontextprotocol#126 will make this easier
2 parents 0358a34 + 3c0679e commit 061316b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

samples/EverythingServer/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
{
3232
"simple_prompt" => [new PromptMessage { Role = Role.User, Content = new Content { Type = "text", Text = "This is a simple prompt without arguments" } }],
3333
"complex_prompt" => [
34-
new PromptMessage { Role = Role.User, Content = new Content { Type = "text", Text = $"This is a complex prompt with arguments: temperature={args.Params?.Arguments?["temperature"]}, style={args.Params?.Arguments?["style"]}" } },
34+
new PromptMessage { Role = Role.User, Content = new Content { Type = "text", Text = $"This is a complex prompt with arguments: temperature={args.Params?.Arguments?["temperature"]}, style={(args.Params?.Arguments?.ContainsKey("style") == true ? args.Params?.Arguments?["style"] : "")}" } },
3535
new PromptMessage { Role = Role.Assistant, Content = new Content { Type = "text", Text = "I understand. You've provided a complex prompt with temperature and style arguments. How would you like me to proceed?" } },
36-
new PromptMessage { Role = Role.User, Content = new Content { Type = "image", Data = TinyImageTool.MCP_TINY_IMAGE, MimeType = "image/png" } }
36+
new PromptMessage { Role = Role.User, Content = new Content { Type = "image", Data = TinyImageTool.MCP_TINY_IMAGE.Split(",").Last(), MimeType = "image/png" } }
3737
]
3838
,
3939
_ => throw new NotSupportedException($"Unknown prompt name: {args.Params?.Name}")

0 commit comments

Comments
 (0)