Skip to main content
Glama

create_role

Create a new user role in BookStack with customizable permissions, display names, and descriptions to manage access control within your wiki.

Instructions

Create a new role

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
display_nameYesDisplay name for the role (required)
descriptionNoRole description
external_auth_idNoExternal authentication ID
permissionsNoArray of permission names to assign to the role

Implementation Reference

  • The handler function for the 'create_role' tool within handleSearchAndUserTool. Extracts and validates input arguments, constructs the data object, invokes BookStackClient.createRole, and formats the response.
    case "create_role": { const { display_name, description, external_auth_id, permissions } = args; if (!display_name) { throw new Error("display_name is required"); } const data = { display_name, description, external_auth_id, permissions: permissions || [], }; const result = await client.createRole(data); return formatApiResponse(result); }
  • Tool registration object in createSearchAndUserTools function array, including name, description, and inputSchema (JSON schema for validation). This defines the MCP tool.
    { name: "create_role", description: "Create a new role", inputSchema: { type: "object", properties: { display_name: { type: "string", description: "Display name for the role (required)", }, 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", items: { type: "string" }, }, }, required: ["display_name"], }, },
  • BookStackClient helper method that wraps the axios POST request to the BookStack /roles endpoint to create a new role.
    async createRole(data: CreateRoleRequest): Promise<Role> { return this.post<Role>("/roles", data); }
  • TypeScript interface defining the CreateRoleRequest type used by the client.createRole method.
    export interface CreateRoleRequest { display_name: string; description?: string; mfa_enforced?: boolean; external_auth_id?: string; permissions?: string[]; }
  • Zod validation schema for CreateRoleRequest, providing runtime validation (though manual validation is used in handler).
    export const CreateRoleSchema = z.object({ display_name: z.string().min(3).max(180), description: z.string().max(180).optional(), mfa_enforced: z.boolean().optional(), external_auth_id: z.string().max(180).optional(), permissions: z.array(z.string()).optional(), }); export const UpdateRoleSchema = CreateRoleSchema.partial();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lautarobarba/bookstack_mcp_server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server