update_role
Modify an existing role's details such as display name, description, external authentication ID, and permissions in BookStack.
Instructions
Update an existing role
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | Role description | |
| display_name | No | Display name for the role | |
| external_auth_id | No | External authentication ID | |
| id | Yes | Role ID | |
| permissions | No | Array of permission names to assign to the role (replaces existing) |
Implementation Reference
- src/tools/search-user-tools.ts:453-459 (handler)The main handler logic for the 'update_role' tool. It destructures the arguments to extract the role ID and update data, parses the ID to an integer, calls the BookStack client's updateRole method, and formats the API response.case "update_role": { const { id, ...updateData } = args; const roleId = parseInteger(id); const result = await client.updateRole(roleId, updateData); return formatApiResponse(result); }
- src/tools/search-user-tools.ts:198-223 (registration)The Tool object definition for 'update_role' returned by createSearchAndUserTools function, including name, description, and inputSchema. This registers the tool with the MCP server.{ name: "update_role", description: "Update an existing role", inputSchema: { type: "object", properties: { id: { type: "number", description: "Role ID" }, display_name: { type: "string", description: "Display name for the role", }, description: { type: "string", description: "Role description" }, external_auth_id: { type: "string", description: "External authentication ID", }, permissions: { type: "array", description: "Array of permission names to assign to the role (replaces existing)", items: { type: "string" }, }, }, required: ["id"], }, },
- src/lib/validation.ts:100-100 (schema)Zod schema definition for updating roles, which is a partial of CreateRoleSchema. Matches the structure used in the tool's inputSchema (plus required id).export const UpdateRoleSchema = CreateRoleSchema.partial();
- src/lib/bookstack-client.ts:324-329 (helper)The BookStackClient method that performs the actual API call to update a role via PUT /roles/{id}.async updateRole( id: number, data: Partial<CreateRoleRequest> ): Promise<Role> { return this.put<Role>(`/roles/${id}`, data); }
- src/index.ts:124-128 (registration)Dispatch logic in the main CallToolRequestSchema handler that routes 'update_role' (included in searchUserToolNames) to the appropriate handleSearchAndUserTool function.if (contentToolNames.includes(name)) { result = await handleContentTool(name, args, bookStackClient); } else if (searchUserToolNames.includes(name)) { result = await handleSearchAndUserTool(name, args, bookStackClient); } else {