delete_user
Remove a user account from BookStack wiki while optionally transferring content ownership to another user. Requires administrator permissions to execute.
Instructions
Delete a user account (requires admin permissions)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User ID | |
| migrate_ownership_id | No | ID of user to transfer ownership of content to |
Implementation Reference
- Input schema for the 'delete_user' tool defining parameters: id (required number) and optional migrate_ownership_id (number).{ name: "delete_user", description: "Delete a user account (requires admin permissions)", inputSchema: { type: "object", properties: { id: { type: "number", description: "User ID" }, migrate_ownership_id: { type: "number", description: "ID of user to transfer ownership of content to", }, }, required: ["id"], }, },
- src/tools/search-user-tools.ts:410-419 (handler)Handler logic in handleSearchAndUserTool function that parses arguments, calls client.deleteUser, and returns success message.case "delete_user": { const { id, migrate_ownership_id } = args; const userId = parseInteger(id); const migrateId = migrate_ownership_id ? parseInteger(migrate_ownership_id) : undefined; await client.deleteUser(userId, migrateId); return `User ${userId} deleted successfully`; }
- src/index.ts:55-59 (registration)Registration of tools by including createSearchAndUserTools (which defines delete_user) in the allTools array returned by ListToolsRequestSchema handler.// Combine all tools const allTools: Tool[] = [ ...createContentTools(bookStackClient), ...createSearchAndUserTools(bookStackClient), ];
- src/index.ts:126-128 (registration)Dispatch logic in CallToolRequestSchema handler routes 'delete_user' (listed in searchUserToolNames) to handleSearchAndUserTool.} else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient); } else {
- src/lib/bookstack-client.ts:303-308 (helper)BookStackClient helper method that performs the actual API DELETE request to delete a user, optionally migrating ownership.async deleteUser(id: number, migrateOwnershipId?: number): Promise<void> { const data = migrateOwnershipId ? { migrate_ownership_id: migrateOwnershipId } : undefined; await this.api.delete(`/users/${id}`, { data }); }