|
@@ -456,6 +456,82 @@ const RenderMarkdownRawSchema = z.object({
|
|
|
text: z.string().describe('Raw markdown text to render to HTML'),
|
|
text: z.string().describe('Raw markdown text to render to HTML'),
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// Admin API Schemas
|
|
|
|
|
+const AdminCreateUserSchema = z.object({
|
|
|
|
|
+ source_id: z.number().describe('Authentication source ID (0 for local)'),
|
|
|
|
|
+ login_name: z.string().describe('Login name for authentication'),
|
|
|
|
|
+ username: z.string().describe('Username for the account'),
|
|
|
|
|
+ full_name: z.string().optional().describe('Full name of the user'),
|
|
|
|
|
+ email: z.string().describe('Email address'),
|
|
|
|
|
+ password: z.string().describe('Password for the user'),
|
|
|
|
|
+ send_notify: z.boolean().optional().describe('Send notification email to user (default: false)'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminEditUserSchema = z.object({
|
|
|
|
|
+ username: z.string().describe('Username of the user to edit'),
|
|
|
|
|
+ source_id: z.number().optional().describe('Authentication source ID'),
|
|
|
|
|
+ login_name: z.string().optional().describe('Login name for authentication'),
|
|
|
|
|
+ full_name: z.string().optional().describe('Full name of the user'),
|
|
|
|
|
+ email: z.string().optional().describe('Email address'),
|
|
|
|
|
+ password: z.string().optional().describe('New password'),
|
|
|
|
|
+ website: z.string().optional().describe('Website URL'),
|
|
|
|
|
+ location: z.string().optional().describe('Location'),
|
|
|
|
|
+ active: z.boolean().optional().describe('Whether the account is active'),
|
|
|
|
|
+ admin: z.boolean().optional().describe('Whether the user is an admin'),
|
|
|
|
|
+ allow_git_hook: z.boolean().optional().describe('Allow git hooks'),
|
|
|
|
|
+ allow_import_local: z.boolean().optional().describe('Allow importing local repositories'),
|
|
|
|
|
+ max_repo_creation: z.number().optional().describe('Maximum number of repositories'),
|
|
|
|
|
+ prohibit_login: z.boolean().optional().describe('Prohibit user login'),
|
|
|
|
|
+ allow_create_organization: z.boolean().optional().describe('Allow creating organizations'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminDeleteUserSchema = z.object({
|
|
|
|
|
+ username: z.string().describe('Username of the user to delete'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminCreateUserPublicKeySchema = z.object({
|
|
|
|
|
+ username: z.string().describe('Username to add the key to'),
|
|
|
|
|
+ title: z.string().describe('Title/name for the key'),
|
|
|
|
|
+ key: z.string().describe('Public key content'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminDeleteUserPublicKeySchema = z.object({
|
|
|
|
|
+ username: z.string().describe('Username to remove the key from'),
|
|
|
|
|
+ key_id: z.number().describe('ID of the public key to delete'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminCreateOrgSchema = z.object({
|
|
|
|
|
+ username: z.string().describe('Organization username'),
|
|
|
|
|
+ full_name: z.string().optional().describe('Full name of the organization'),
|
|
|
|
|
+ description: z.string().optional().describe('Organization description'),
|
|
|
|
|
+ website: z.string().optional().describe('Organization website'),
|
|
|
|
|
+ location: z.string().optional().describe('Organization location'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminListOrgTeamsSchema = z.object({
|
|
|
|
|
+ orgname: z.string().describe('Organization name'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminCreateUserOrgSchema = z.object({
|
|
|
|
|
+ username: z.string().describe('Username who will own the organization'),
|
|
|
|
|
+ org_username: z.string().describe('Organization username'),
|
|
|
|
|
+ full_name: z.string().optional().describe('Full name of the organization'),
|
|
|
|
|
+ description: z.string().optional().describe('Organization description'),
|
|
|
|
|
+ website: z.string().optional().describe('Organization website'),
|
|
|
|
|
+ location: z.string().optional().describe('Organization location'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const AdminCreateUserRepoSchema = z.object({
|
|
|
|
|
+ username: z.string().describe('Username who will own the repository'),
|
|
|
|
|
+ name: z.string().describe('Repository name'),
|
|
|
|
|
+ description: z.string().optional().describe('Repository description'),
|
|
|
|
|
+ private: z.boolean().optional().describe('Create as private repository (default: false)'),
|
|
|
|
|
+ auto_init: z.boolean().optional().describe('Initialize with README (default: false)'),
|
|
|
|
|
+ gitignores: z.string().optional().describe('Gitignore templates (e.g., "Go,VisualStudioCode")'),
|
|
|
|
|
+ license: z.string().optional().describe('License template (e.g., "MIT License")'),
|
|
|
|
|
+ readme: z.string().optional().describe('README template (default: "Default")'),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Create and configure an MCP server with all tools and handlers
|
|
* Create and configure an MCP server with all tools and handlers
|
|
|
*/
|
|
*/
|
|
@@ -2154,6 +2230,288 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
required: ['text'],
|
|
required: ['text'],
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_create_user',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Create a new user',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ source_id: {
|
|
|
|
|
+ type: 'number',
|
|
|
|
|
+ description: 'Authentication source ID (0 for local)',
|
|
|
|
|
+ },
|
|
|
|
|
+ login_name: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Login name for authentication',
|
|
|
|
|
+ },
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Username for the account',
|
|
|
|
|
+ },
|
|
|
|
|
+ full_name: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Full name of the user',
|
|
|
|
|
+ },
|
|
|
|
|
+ email: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Email address',
|
|
|
|
|
+ },
|
|
|
|
|
+ password: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Password for the user',
|
|
|
|
|
+ },
|
|
|
|
|
+ send_notify: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Send notification email to user (default: false)',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['source_id', 'login_name', 'username', 'email', 'password'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_edit_user',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Edit user properties',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Username of the user to edit',
|
|
|
|
|
+ },
|
|
|
|
|
+ source_id: {
|
|
|
|
|
+ type: 'number',
|
|
|
|
|
+ description: 'Authentication source ID',
|
|
|
|
|
+ },
|
|
|
|
|
+ login_name: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Login name for authentication',
|
|
|
|
|
+ },
|
|
|
|
|
+ full_name: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Full name of the user',
|
|
|
|
|
+ },
|
|
|
|
|
+ email: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Email address',
|
|
|
|
|
+ },
|
|
|
|
|
+ password: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'New password',
|
|
|
|
|
+ },
|
|
|
|
|
+ website: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Website URL',
|
|
|
|
|
+ },
|
|
|
|
|
+ location: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Location',
|
|
|
|
|
+ },
|
|
|
|
|
+ active: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Whether the account is active',
|
|
|
|
|
+ },
|
|
|
|
|
+ admin: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Whether the user is an admin',
|
|
|
|
|
+ },
|
|
|
|
|
+ allow_git_hook: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Allow git hooks',
|
|
|
|
|
+ },
|
|
|
|
|
+ allow_import_local: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Allow importing local repositories',
|
|
|
|
|
+ },
|
|
|
|
|
+ max_repo_creation: {
|
|
|
|
|
+ type: 'number',
|
|
|
|
|
+ description: 'Maximum number of repositories',
|
|
|
|
|
+ },
|
|
|
|
|
+ prohibit_login: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Prohibit user login',
|
|
|
|
|
+ },
|
|
|
|
|
+ allow_create_organization: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Allow creating organizations',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['username'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_delete_user',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Delete a user',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Username of the user to delete',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['username'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_create_user_public_key',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Create public key for user',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Username to add the key to',
|
|
|
|
|
+ },
|
|
|
|
|
+ title: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Title/name for the key',
|
|
|
|
|
+ },
|
|
|
|
|
+ key: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Public key content',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['username', 'title', 'key'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_delete_user_public_key',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Delete public key for user',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Username to remove the key from',
|
|
|
|
|
+ },
|
|
|
|
|
+ key_id: {
|
|
|
|
|
+ type: 'number',
|
|
|
|
|
+ description: 'ID of the public key to delete',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['username', 'key_id'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_create_org',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Create an organization',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization username',
|
|
|
|
|
+ },
|
|
|
|
|
+ full_name: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Full name of the organization',
|
|
|
|
|
+ },
|
|
|
|
|
+ description: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization description',
|
|
|
|
|
+ },
|
|
|
|
|
+ website: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization website',
|
|
|
|
|
+ },
|
|
|
|
|
+ location: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization location',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['username'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_list_org_teams',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] List organization teams',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ orgname: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization name',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['orgname'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_create_user_org',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Create organization for user',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Username who will own the organization',
|
|
|
|
|
+ },
|
|
|
|
|
+ org_username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization username',
|
|
|
|
|
+ },
|
|
|
|
|
+ full_name: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Full name of the organization',
|
|
|
|
|
+ },
|
|
|
|
|
+ description: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization description',
|
|
|
|
|
+ },
|
|
|
|
|
+ website: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization website',
|
|
|
|
|
+ },
|
|
|
|
|
+ location: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Organization location',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['username', 'org_username'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'admin_create_user_repo',
|
|
|
|
|
+ description: '⚠️ [ADMIN ONLY] Create repository for user',
|
|
|
|
|
+ inputSchema: {
|
|
|
|
|
+ type: 'object',
|
|
|
|
|
+ properties: {
|
|
|
|
|
+ username: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Username who will own the repository',
|
|
|
|
|
+ },
|
|
|
|
|
+ name: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Repository name',
|
|
|
|
|
+ },
|
|
|
|
|
+ description: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Repository description',
|
|
|
|
|
+ },
|
|
|
|
|
+ private: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Create as private repository (default: false)',
|
|
|
|
|
+ },
|
|
|
|
|
+ auto_init: {
|
|
|
|
|
+ type: 'boolean',
|
|
|
|
|
+ description: 'Initialize with README (default: false)',
|
|
|
|
|
+ },
|
|
|
|
|
+ gitignores: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'Gitignore templates (e.g., "Go,VisualStudioCode")',
|
|
|
|
|
+ },
|
|
|
|
|
+ license: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'License template (e.g., "MIT License")',
|
|
|
|
|
+ },
|
|
|
|
|
+ readme: {
|
|
|
|
|
+ type: 'string',
|
|
|
|
|
+ description: 'README template (default: "Default")',
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ required: ['username', 'name'],
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
],
|
|
],
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
@@ -3234,6 +3592,136 @@ export function createMcpServer(gogsClient: GogsClient): Server {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Admin API handlers
|
|
|
|
|
+ case 'admin_create_user': {
|
|
|
|
|
+ const data = AdminCreateUserSchema.parse(args);
|
|
|
|
|
+ const user = await gogsClient.adminCreateUser(data);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(user, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_edit_user': {
|
|
|
|
|
+ const { username, ...data } = AdminEditUserSchema.parse(args);
|
|
|
|
|
+ const user = await gogsClient.adminEditUser(username, data);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(user, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_delete_user': {
|
|
|
|
|
+ const { username } = AdminDeleteUserSchema.parse(args);
|
|
|
|
|
+ await gogsClient.adminDeleteUser(username);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify({
|
|
|
|
|
+ success: true,
|
|
|
|
|
+ message: `Successfully deleted user ${username}`,
|
|
|
|
|
+ username,
|
|
|
|
|
+ }, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_create_user_public_key': {
|
|
|
|
|
+ const { username, title, key } = AdminCreateUserPublicKeySchema.parse(args);
|
|
|
|
|
+ const publicKey = await gogsClient.adminCreateUserPublicKey(username, { title, key });
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(publicKey, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_delete_user_public_key': {
|
|
|
|
|
+ const { username, key_id } = AdminDeleteUserPublicKeySchema.parse(args);
|
|
|
|
|
+ await gogsClient.adminDeleteUserPublicKey(username, key_id);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify({
|
|
|
|
|
+ success: true,
|
|
|
|
|
+ message: `Successfully deleted public key ${key_id} for user ${username}`,
|
|
|
|
|
+ username,
|
|
|
|
|
+ key_id,
|
|
|
|
|
+ }, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_create_org': {
|
|
|
|
|
+ const data = AdminCreateOrgSchema.parse(args);
|
|
|
|
|
+ const org = await gogsClient.adminCreateOrg(data);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(org, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_list_org_teams': {
|
|
|
|
|
+ const { orgname } = AdminListOrgTeamsSchema.parse(args);
|
|
|
|
|
+ const teams = await gogsClient.adminListOrgTeams(orgname);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(teams, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_create_user_org': {
|
|
|
|
|
+ const { username, org_username, ...orgData } = AdminCreateUserOrgSchema.parse(args);
|
|
|
|
|
+ const org = await gogsClient.adminCreateUserOrg(username, {
|
|
|
|
|
+ username: org_username,
|
|
|
|
|
+ ...orgData,
|
|
|
|
|
+ });
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(org, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ case 'admin_create_user_repo': {
|
|
|
|
|
+ const { username, ...repoData } = AdminCreateUserRepoSchema.parse(args);
|
|
|
|
|
+ const repo = await gogsClient.adminCreateUserRepo(username, repoData);
|
|
|
|
|
+ return {
|
|
|
|
|
+ content: [
|
|
|
|
|
+ {
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: JSON.stringify(repo, null, 2),
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
default:
|
|
default:
|
|
|
throw new Error(`Unknown tool: ${name}`);
|
|
throw new Error(`Unknown tool: ${name}`);
|
|
|
}
|
|
}
|