Add EverythingServer sample (#151)
This commit is contained in:
parent
d21d933876
commit
01410df5ad
1 changed files with 620 additions and 1 deletions
18
samples/EverythingServer/Tools/PrintEnvTool.cs
Normal file
18
samples/EverythingServer/Tools/PrintEnvTool.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using ModelContextProtocol.Server;
|
||||
using System.ComponentModel;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace EverythingServer.Tools;
|
||||
|
||||
[McpServerToolType]
|
||||
public class PrintEnvTool
|
||||
{
|
||||
private static readonly JsonSerializerOptions options = new()
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
[McpServerTool(Name = "printEnv"), Description("Prints all environment variables, helpful for debugging MCP server configuration")]
|
||||
public static string PrintEnv() =>
|
||||
JsonSerializer.Serialize(Environment.GetEnvironmentVariables(), options);
|
||||
}
|
||||
Loading…
Reference in a new issue