Skip to content

Instantly share code, notes, and snippets.

@medhatelmasry
Created September 29, 2025 20:24
Show Gist options
  • Select an option

  • Save medhatelmasry/69a9ab11a1add5b28a0b61a66ade7fa6 to your computer and use it in GitHub Desktop.

Select an option

Save medhatelmasry/69a9ab11a1add5b28a0b61a66ade7fa6 to your computer and use it in GitHub Desktop.
ZodiacMcpTool
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