Skip to main content
Glama

canvas_create_user

Add a new user to a Canvas account by specifying account ID, user details, and login credentials, including name, unique ID, and optional time zone or SIS ID.

Instructions

Create a new user in an account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idYesID of the account
pseudonymYes
userYes

Implementation Reference

  • Core handler function in CanvasClient that performs the POST request to Canvas API endpoint `/accounts/{account_id}/users` to create a new user account.
    async createUser(args: CreateUserArgs): Promise<CanvasUser> {
      const { account_id, ...userData } = args;
      const response = await this.client.post(`/accounts/${account_id}/users`, userData);
      return response.data;
    }
  • src/index.ts:755-785 (registration)
    Tool registration in the TOOLS array, defining name, description, and input schema for the canvas_create_user tool.
    {
      name: "canvas_create_user",
      description: "Create a new user in an account",
      inputSchema: {
        type: "object",
        properties: {
          account_id: { type: "number", description: "ID of the account" },
          user: {
            type: "object",
            properties: {
              name: { type: "string", description: "Full name of the user" },
              short_name: { type: "string", description: "Short name of the user" },
              sortable_name: { type: "string", description: "Sortable name (Last, First)" },
              time_zone: { type: "string", description: "User's time zone" }
            },
            required: ["name"]
          },
          pseudonym: {
            type: "object",
            properties: {
              unique_id: { type: "string", description: "Unique login ID (email or username)" },
              password: { type: "string", description: "User's password" },
              sis_user_id: { type: "string", description: "SIS ID for the user" },
              send_confirmation: { type: "boolean", description: "Send confirmation email" }
            },
            required: ["unique_id"]
          }
        },
        required: ["account_id", "user", "pseudonym"]
      }
    },
  • MCP server handler case that validates arguments, invokes CanvasClient.createUser, and formats the response for the tool call.
    case "canvas_create_user": {
      const createUserArgs = args as unknown as CreateUserArgs;
      if (!createUserArgs.account_id || !createUserArgs.user || !createUserArgs.pseudonym) {
        throw new Error("Missing required fields: account_id, user, and pseudonym");
      }
      
      const user = await this.client.createUser(createUserArgs);
      return {
        content: [{ type: "text", text: JSON.stringify(user, null, 2) }]
      };
    }
  • TypeScript interface defining the input arguments for creating a Canvas user, used for type safety and validation.
    export interface CreateUserArgs {
      account_id: number;
      user: {
        name: string;
        short_name?: string;
        sortable_name?: string;
        time_zone?: string;
        locale?: string;
        birthdate?: string;
        terms_of_use?: boolean;
        skip_registration?: boolean;
      };
      pseudonym: {
        unique_id: string;
        password?: string;
        sis_user_id?: string;
        integration_id?: string;
        send_confirmation?: boolean;
        force_validations?: boolean;
        authentication_provider_id?: string;
      };
      communication_channel?: {
        type: 'email' | 'sms';
        address: string;
        skip_confirmation?: boolean;
      };
      force_validations?: boolean;
      enable_sis_reactivation?: boolean;
    }

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/DMontgomery40/mcp-canvas-lms'

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