Skip to content

Commit 35b2d63

Browse files
committed
Add examples of icons on tools, resources, and prompts
1 parent 0897ca1 commit 35b2d63

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

samples/EverythingServer/Program.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,38 @@
5858
.WithTools<PrintEnvTool>()
5959
.WithTools<SampleLlmTool>()
6060
.WithTools<TinyImageTool>()
61+
.WithTools([
62+
// A tool with multiple complex icons demonstrating different themes, sizes, and MIME types
63+
McpServerTool.Create(
64+
WeatherTool.GetWeather,
65+
new McpServerToolCreateOptions
66+
{
67+
Name = "get_weather",
68+
Title = "Get Weather Information",
69+
Icons = [
70+
new Icon
71+
{
72+
Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Sun/Flat/sun_flat.svg",
73+
MimeType = "image/svg+xml",
74+
Sizes = ["any"],
75+
Theme = "light"
76+
},
77+
new Icon
78+
{
79+
Source = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Sun/Flat/sun_flat.svg",
80+
MimeType = "image/svg+xml",
81+
Sizes = ["any"],
82+
Theme = "dark"
83+
},
84+
new Icon
85+
{
86+
Source = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
87+
MimeType = "image/png",
88+
Sizes = ["16x16", "32x32"]
89+
}
90+
]
91+
})
92+
])
6193
.WithPrompts<ComplexPromptType>()
6294
.WithPrompts<SimplePromptType>()
6395
.WithResources<SimpleResourceType>()

samples/EverythingServer/Prompts/SimplePromptType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ namespace EverythingServer.Prompts;
66
[McpServerPromptType]
77
public class SimplePromptType
88
{
9-
[McpServerPrompt(Name = "simple_prompt"), Description("A prompt without arguments")]
9+
[McpServerPrompt(Name = "simple_prompt", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Light%20bulb/Flat/light_bulb_flat.svg"), Description("A prompt without arguments")]
1010
public static string SimplePrompt() => "This is a simple prompt without arguments";
1111
}

samples/EverythingServer/Resources/SimpleResourceType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace EverythingServer.Resources;
77
[McpServerResourceType]
88
public class SimpleResourceType
99
{
10-
[McpServerResource(UriTemplate = "test://direct/text/resource", Name = "Direct Text Resource", MimeType = "text/plain")]
10+
[McpServerResource(UriTemplate = "test://direct/text/resource", Name = "Direct Text Resource", MimeType = "text/plain", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Memo/Flat/memo_flat.svg")]
1111
[Description("A direct text resource")]
1212
public static string DirectTextResource() => "This is a direct resource";
1313

samples/EverythingServer/Tools/AddTool.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ namespace EverythingServer.Tools;
66
[McpServerToolType]
77
public class AddTool
88
{
9-
[McpServerTool(Name = "add"), Description("Adds two numbers.")]
9+
[McpServerTool(Name = "add", IconSource = "https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Plus/Flat/plus_flat.svg"), Description("Adds two numbers.")]
1010
public static string Add(int a, int b) => $"The sum of {a} and {b} is {a + b}";
1111
}

0 commit comments

Comments
 (0)