20 lines
1.1 KiB
C#
20 lines
1.1 KiB
C#
using System.ComponentModel;
|
|
using ModelContextProtocol.Server;
|
|
using System.Text.Json.Nodes;
|
|
|
|
namespace PLCSharp.Mcp;
|
|
|
|
[McpServerToolType]
|
|
internal sealed class ProjectTools(ProjectGateway gateway)
|
|
{
|
|
[McpServerTool(Name = "get_project_summary", ReadOnly = true), Description("Read the bound PLCSharp project, default recipe and available object kinds.")]
|
|
public string Summary() => gateway.Call("summary", new());
|
|
|
|
[McpServerTool(Name = "list_objects", ReadOnly = true), Description("List one object kind from the summary, optionally scoped to a recipe. Pages start at offset zero.")]
|
|
public string ListObjects(string kind, string recipeId = null, int offset = 0, int limit = 50) =>
|
|
gateway.Call("list", new() { ["kind"] = kind, ["recipeId"] = recipeId, ["offset"] = offset, ["limit"] = limit });
|
|
|
|
[McpServerTool(Name = "get_object", ReadOnly = true), Description("Read one project object by kind and stable ID, including source for workflows.")]
|
|
public string GetObject(string kind, string id) => gateway.Call("get", new() { ["kind"] = kind, ["id"] = id });
|
|
}
|