delete_role
Remove a role from the BookStack wiki system, with optional content ownership transfer to another role before deletion.
Instructions
Delete a role (users with this role will lose it)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Role ID | |
| migrate_ownership_id | No | ID of role to transfer ownership of content to |
Implementation Reference
- src/tools/search-user-tools.ts:461-470 (handler)Handler for the 'delete_role' tool. Parses input arguments for role ID (ignores migrate_ownership_id), calls BookStackClient.deleteRole, and returns success message.case "delete_role": { const { id, migrate_ownership_id } = args; const roleId = parseInteger(id); const migrateId = migrate_ownership_id ? parseInteger(migrate_ownership_id) : undefined; await client.deleteRole(roleId); return `Role ${roleId} deleted successfully`; }
- Tool schema definition for 'delete_role', including input validation for role ID (required) and optional migrate_ownership_id.{ name: "delete_role", description: "Delete a role (users with this role will lose it)", inputSchema: { type: "object", properties: { id: { type: "number", description: "Role ID" }, migrate_ownership_id: { type: "number", description: "ID of role to transfer ownership of content to", }, }, required: ["id"], }, },
- src/lib/bookstack-client.ts:331-333 (helper)Supporting method in BookStackClient that executes the DELETE request to the BookStack API endpoint /roles/{id}.async deleteRole(id: number): Promise<void> { return this.delete(`/roles/${id}`); }
- src/index.ts:103-128 (registration)Registration and dispatch logic in main server handler. 'delete_role' is listed in searchUserToolNames array to route tool calls to handleSearchAndUserTool.const searchUserToolNames = [ "search_all", "list_users", "get_user", "create_user", "update_user", "delete_user", "list_roles", "get_role", "create_role", "update_role", "delete_role", "list_attachments", "get_attachment", "delete_attachment", "list_images", "get_image", "update_image", "delete_image", ]; if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient); } else {