You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[McpServerTool("turn_on","Turn on the light. Check the location to make sure it's the proper location first. Do not change location of this light to turn it on.")]
24
+
publicstaticvoidTurnOn()
25
+
{
26
+
if(_lightPin==null)
27
+
{
28
+
Initialize();
29
+
}
30
+
31
+
Debug.WriteLine($"Turning on the light at location: {_location}");
32
+
_lightPin.Write(PinValue.Low);
33
+
}
34
+
35
+
[McpServerTool("turn_off","Turn off the light. Check the location to make sure it's the proper location first. Do not change location of this light to turn it off.")]
36
+
publicstaticvoidTurnOff()
37
+
{
38
+
if(_lightPin==null)
39
+
{
40
+
Initialize();
41
+
}
42
+
43
+
Debug.WriteLine($"Turning off the light at location: {_location}");
44
+
_lightPin.Write(PinValue.High);
45
+
}
46
+
47
+
[McpServerTool("get_location","Get the location of the light. Check this before switching a light on or off.")]
48
+
publicstaticstringGetLocation()
49
+
{
50
+
Debug.WriteLine($"Getting the location of the light: {_location}");
51
+
return_location;
52
+
}
53
+
54
+
[McpServerTool("set_location","Change the location of the light. Do not change the location of the light unless the user ask you to change the location.")]
55
+
publicstaticvoidSetLocation(stringlocation)
56
+
{
57
+
if(string.IsNullOrEmpty(location))
58
+
{
59
+
thrownewArgumentException("Location cannot be null or empty.",nameof(location));
60
+
}
61
+
62
+
Debug.WriteLine($"Setting the location of the light to: {location}");
{// Optional: Customize MCP server information and instructions
30
+
// This will override the default server name "nanoFramework" and version "1.0.0"
31
+
McpServerController.ServerName="MyIoTDevice";
32
+
McpServerController.ServerVersion="2.1.0";
33
+
34
+
// Optional: Customize instructions sent to AI agents
35
+
// This will override the default instruction about single request limitation
36
+
McpServerController.Instructions="This is my custom IoT device. Please send requests one at a time and wait for responses. Supports GPIO control and sensor readings.";
0 commit comments