update_user
Modify user account details in BookStack, including name, email, password, roles, language, and authentication settings.
Instructions
Update an existing user account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | User ID | |
| name | No | Full name of the user | |
| No | Email address (must be unique) | ||
| password | No | New password (min 8 characters) | |
| roles | No | Array of role IDs to assign to the user (replaces existing) | |
| language | No | User interface language code | |
| external_auth_id | No | External authentication ID |
Implementation Reference
- src/tools/search-user-tools.ts:402-408 (handler)Executes the update_user tool by extracting user ID and update data from arguments, parsing the ID, calling the BookStackClient's updateUser method, and formatting the API response.case "update_user": { const { id, migrate_ownership_id, ...updateData } = args; const userId = parseInteger(id); const result = await client.updateUser(userId, updateData); return formatApiResponse(result); }
- Defines the MCP tool 'update_user' including its name, description, and input schema specifying parameters like id (required), name, email, password, roles, language, and external_auth_id.{ name: "update_user", description: "Update an existing user account", inputSchema: { type: "object", properties: { id: { type: "number", description: "User ID" }, name: { type: "string", description: "Full name of the user" }, email: { type: "string", description: "Email address (must be unique)", }, password: { type: "string", description: "New password (min 8 characters)", }, roles: { type: "array", description: "Array of role IDs to assign to the user (replaces existing)", items: { type: "number" }, }, language: { type: "string", description: "User interface language code", }, external_auth_id: { type: "string", description: "External authentication ID", }, }, required: ["id"], }, },
- src/lib/bookstack-client.ts:296-301 (helper)BookStackClient method that performs the actual API PUT request to update a user at /users/{id} with the provided partial user data.async updateUser( id: number, data: Partial<CreateUserRequest> ): Promise<User> { return this.put<User>(`/users/${id}`, data); }
- src/index.ts:102-128 (registration)Registers 'update_user' in the searchUserToolNames array used to dispatch tool calls to the appropriate handler (handleSearchAndUserTool). The tools are also included via createSearchAndUserTools in the allTools list for listTools endpoint.// Search and user tools 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 {
- src/lib/validation.ts:90-91 (helper)Zod schema for validating partial updates to user data, used in type definitions for CreateUserRequest.export const UpdateUserSchema = CreateUserSchema.partial();