-
-
Save EngincanV/3cdc9cfdc1fa1ee7b99e7c5b02f58b8b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [McpServerToolType] | |
| public static class TimeTools | |
| { | |
| [McpServerTool, Description("Gets the current time")] | |
| public static string GetCurrentTime() | |
| { | |
| return DateTimeOffset.Now.ToString(); | |
| } | |
| [McpServerTool, Description("Gets time in specific timezone")] | |
| public static string GetTimeInTimezone(string timezone) | |
| { | |
| try | |
| { | |
| var tz = TimeZoneInfo.FindSystemTimeZoneById(timezone); | |
| return TimeZoneInfo.ConvertTime(DateTimeOffset.Now, tz).ToString(); | |
| } | |
| catch | |
| { | |
| return "Invalid timezone specified"; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment