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();
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Create a new role' implies a write operation but lacks details on permissions required, whether the role is immediately active, potential side effects, or error conditions. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It is front-loaded and appropriately sized for its purpose, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a mutation tool with no annotations and no output schema, the description is incomplete. It lacks information on behavioral traits, usage context, and return values, leaving significant gaps for an AI agent to understand how to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond the schema, such as examples or constraints. Baseline 3 is appropriate when the schema does the heavy lifting, but no extra value is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a new role' clearly states the verb ('Create') and resource ('role'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'create_user' or 'create_book' beyond specifying the resource type, which is why it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are no mentions of prerequisites, when-not-to-use scenarios, or comparisons with sibling tools like 'update_role' or 'list_roles', leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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