Created
September 29, 2025 20:24
-
-
Save medhatelmasry/69a9ab11a1add5b28a0b61a66ade7fa6 to your computer and use it in GitHub Desktop.
ZodiacMcpTool
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
| public class ZodiacMcpTool { | |
| [Function("ZodiacMcpTool")] | |
| public IActionResult Run( | |
| [McpToolTrigger(McpToolDefinitions.ZodiacTool.Name, McpToolDefinitions.ZodiacTool.Description)] | |
| ToolInvocationContext context, | |
| [McpToolProperty(McpToolDefinitions.ZodiacTool.Param.Name, McpToolDefinitions.DataTypes.Number, McpToolDefinitions.ZodiacTool.Param.Description)] | |
| int year) | |
| { | |
| return new OkObjectResult($"Hi. I am {McpToolDefinitions.ZodiacTool.Name}!. The zodiac animal for the year {year} is: {GetZodiacAnimal(year)}"); | |
| } | |
| private string GetZodiacAnimal(int year) { | |
| string[] zodiacAnimals = new string[] { | |
| "Monkey", "Rooster", "Dog", "Pig", "Rat", "Ox", | |
| "Tiger", "Rabbit", "Dragon", "Snake", "Horse", "Goat" | |
| }; | |
| int index = year % 12; | |
| return zodiacAnimals[index]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment