| 1 | using AgentForge.Abstractions; |
| 2 | using AgentForge.Mcp.Core; |
| 3 | |
| 4 | namespace AgentForge.Plugin.Org.Web; |
| 5 | |
| 6 | internal static class ForgeOrgMcpTools |
| 7 | { |
| 8 | internal static void Register(ForgeMcpToolRegistry registry) |
| 9 | { |
| 10 | ForgeMcpHttpTools.Add(registry, OrgListDescriptor, (client, _, ct) => client.ListOrgsAsync(ct)); |
| 11 | ForgeMcpHttpTools.Add(registry, OrgCreateDescriptor, (client, args, ct) => |
| 12 | client.CreateOrgAsync(ForgeMcpArgParser.ParseCreateOrg(args), ct)); |
| 13 | ForgeMcpHttpTools.Add(registry, OrgGetDescriptor, (client, args, ct) => |
| 14 | client.GetOrgAsync(ForgeMcpArgParser.RequireString(args, "slug"), ct)); |
| 15 | ForgeMcpHttpTools.Add(registry, RepoGroupListDescriptor, (client, args, ct) => |
| 16 | client.ListRepoGroupsAsync(ForgeMcpArgParser.RequireString(args, "org"), ct)); |
| 17 | ForgeMcpHttpTools.Add(registry, RepoGroupCreateDescriptor, (client, args, ct) => |
| 18 | client.CreateRepoGroupAsync( |
| 19 | ForgeMcpArgParser.RequireString(args, "org"), |
| 20 | ForgeMcpArgParser.ParseCreateRepoGroup(args), |
| 21 | ct)); |
| 22 | ForgeMcpHttpTools.Add(registry, RepoGroupGetDescriptor, (client, args, ct) => |
| 23 | client.GetRepoGroupAsync( |
| 24 | ForgeMcpArgParser.RequireString(args, "org"), |
| 25 | ForgeMcpArgParser.RequireString(args, "slug"), |
| 26 | ct)); |
| 27 | } |
| 28 | |
| 29 | private static readonly ForgeMcpToolDescriptor OrgListDescriptor = new() |
| 30 | { |
| 31 | Name = ForgeMcpToolNames.OrgList, |
| 32 | Description = "Список organizations (org-web plugin).", |
| 33 | InputSchema = ForgeMcpSchemas.EmptyObject, |
| 34 | }; |
| 35 | |
| 36 | private static readonly ForgeMcpToolDescriptor OrgCreateDescriptor = new() |
| 37 | { |
| 38 | Name = ForgeMcpToolNames.OrgCreate, |
| 39 | Description = "Создать organization (bootstrap token).", |
| 40 | InputSchema = ForgeMcpSchemas.Object(new |
| 41 | { |
| 42 | type = "object", |
| 43 | properties = new |
| 44 | { |
| 45 | slug = new { type = "string" }, |
| 46 | display_name = new { type = "string" }, |
| 47 | description = new { type = "string" }, |
| 48 | default_visibility = new { type = "string", description = "public | private" }, |
| 49 | }, |
| 50 | required = new[] { "slug" }, |
| 51 | }), |
| 52 | }; |
| 53 | |
| 54 | private static readonly ForgeMcpToolDescriptor OrgGetDescriptor = new() |
| 55 | { |
| 56 | Name = ForgeMcpToolNames.OrgGet, |
| 57 | Description = "Organization по slug.", |
| 58 | InputSchema = ForgeMcpSchemas.Object(new |
| 59 | { |
| 60 | type = "object", |
| 61 | properties = new { slug = new { type = "string" } }, |
| 62 | required = new[] { "slug" }, |
| 63 | }), |
| 64 | }; |
| 65 | |
| 66 | private static readonly ForgeMcpToolDescriptor RepoGroupListDescriptor = new() |
| 67 | { |
| 68 | Name = ForgeMcpToolNames.RepoGroupList, |
| 69 | Description = "Список repository groups в org.", |
| 70 | InputSchema = ForgeMcpSchemas.Object(new |
| 71 | { |
| 72 | type = "object", |
| 73 | properties = new { org = new { type = "string" } }, |
| 74 | required = new[] { "org" }, |
| 75 | }), |
| 76 | }; |
| 77 | |
| 78 | private static readonly ForgeMcpToolDescriptor RepoGroupCreateDescriptor = new() |
| 79 | { |
| 80 | Name = ForgeMcpToolNames.RepoGroupCreate, |
| 81 | Description = "Создать repository group в org.", |
| 82 | InputSchema = ForgeMcpSchemas.Object(new |
| 83 | { |
| 84 | type = "object", |
| 85 | properties = new |
| 86 | { |
| 87 | org = new { type = "string" }, |
| 88 | slug = new { type = "string", description = "Leaf group slug (a-z, 0-9, hyphens)." }, |
| 89 | parent = new { type = "string", description = "Parent catalog path, e.g. showcase/mcp-tools (optional)." }, |
| 90 | display_name = new { type = "string", description = "Human label (optional)." }, |
| 91 | description = new { type = "string", description = "Описание (optional)." }, |
| 92 | default_visibility = new { type = "string", description = "public | private" }, |
| 93 | }, |
| 94 | required = new[] { "org", "slug" }, |
| 95 | }), |
| 96 | }; |
| 97 | |
| 98 | private static readonly ForgeMcpToolDescriptor RepoGroupGetDescriptor = new() |
| 99 | { |
| 100 | Name = ForgeMcpToolNames.RepoGroupGet, |
| 101 | Description = "Repository group по org + catalog path.", |
| 102 | InputSchema = ForgeMcpSchemas.Object(new |
| 103 | { |
| 104 | type = "object", |
| 105 | properties = new |
| 106 | { |
| 107 | org = new { type = "string" }, |
| 108 | slug = new { type = "string", description = "Catalog path (showcase or showcase/mcp-tools)." }, |
| 109 | }, |
| 110 | required = new[] { "org", "slug" }, |
| 111 | }), |
| 112 | }; |
| 113 | } |
| 114 | |