| 1 | using AgentForge.Abstractions; |
| 2 | using AgentForge.Mcp.Core; |
| 3 | |
| 4 | namespace AgentForge.Plugin.Organization.UserManagement; |
| 5 | |
| 6 | internal static class ForgeOrgMemberMcpTools |
| 7 | { |
| 8 | internal static void Register(ForgeMcpToolRegistry registry) |
| 9 | { |
| 10 | ForgeMcpHttpTools.Add(registry, OrgMemberAddDescriptor, (client, args, ct) => |
| 11 | client.AddOrgMemberAsync( |
| 12 | ForgeMcpArgParser.RequireString(args, "org"), |
| 13 | ForgeMcpArgParser.ParseAddOrgMember(args), |
| 14 | ct)); |
| 15 | ForgeMcpHttpTools.Add(registry, OrgMemberListDescriptor, (client, args, ct) => |
| 16 | client.ListOrgMembersAsync(ForgeMcpArgParser.RequireString(args, "org"), ct)); |
| 17 | } |
| 18 | |
| 19 | private static readonly ForgeMcpToolDescriptor OrgMemberAddDescriptor = new() |
| 20 | { |
| 21 | Name = ForgeMcpToolNames.OrgMemberAdd, |
| 22 | Description = "Добавить OAuth identity в org (org admin or bootstrap).", |
| 23 | InputSchema = ForgeMcpSchemas.Object(new |
| 24 | { |
| 25 | type = "object", |
| 26 | properties = new |
| 27 | { |
| 28 | org = new { type = "string" }, |
| 29 | provider = new { type = "string", description = "github" }, |
| 30 | login = new { type = "string" }, |
| 31 | role = new { type = "string", description = "member | admin | owner (owner = admin)" }, |
| 32 | }, |
| 33 | required = new[] { "org", "provider", "login" }, |
| 34 | }), |
| 35 | }; |
| 36 | |
| 37 | private static readonly ForgeMcpToolDescriptor OrgMemberListDescriptor = new() |
| 38 | { |
| 39 | Name = ForgeMcpToolNames.OrgMemberList, |
| 40 | Description = "Список members org (org admin or bootstrap).", |
| 41 | InputSchema = ForgeMcpSchemas.Object(new |
| 42 | { |
| 43 | type = "object", |
| 44 | properties = new { org = new { type = "string" } }, |
| 45 | required = new[] { "org" }, |
| 46 | }), |
| 47 | }; |
| 48 | } |
| 49 | |