csharp-sdk/samples/EverythingServer/Tools/PrintEnvTool.cs
2025-04-04 11:48:53 -07:00

18 lines
543 B
C#

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);
}