update_user
Modify an existing BookStack user account by updating details such as name, email, password, roles, language, or external authentication ID.
Instructions
Update an existing user account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | Email address (must be unique) | ||
| external_auth_id | No | External authentication ID | |
| id | Yes | User ID | |
| language | No | User interface language code | |
| name | No | Full name of the user | |
| password | No | New password (min 8 characters) | |
| roles | No | Array of role IDs to assign to the user (replaces existing) |
Implementation Reference
- src/tools/search-user-tools.ts:402-408 (handler)The handler logic for the 'update_user' tool within the handleSearchAndUserTool function. It extracts the user ID and update data from arguments, calls the BookStackClient.updateUser method, and returns a formatted 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); }
- src/tools/search-user-tools.ts:100-133 (registration)The tool registration definition for 'update_user', including name, description, and input schema, returned by createSearchAndUserTools and registered in the MCP server.{ 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)The BookStackClient helper method that wraps the Axios PUT request to the BookStack API endpoint `/users/{id}` for updating user information.async updateUser( id: number, data: Partial<CreateUserRequest> ): Promise<User> { return this.put<User>(`/users/${id}`, data); }
- src/lib/validation.ts:90-91 (schema)Zod schema definition for validating update_user input data, based on partial CreateUserSchema (though not directly used in the tool handler).export const UpdateUserSchema = CreateUserSchema.partial();
- src/index.ts:104-122 (registration)The 'update_user' tool is listed in the searchUserToolNames array used to dispatch calls to the appropriate handler in the MCP server's CallToolRequest handler."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", ];