Skip to main content
Glama

canvas_enroll_user

Enroll a user in a Canvas course by specifying course ID, user ID, role, and enrollment state using the MCP server for Canvas API interactions.

Instructions

Enroll a user in a course

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_idYesID of the course
enrollment_stateNoState of the enrollment (active, invited, etc.)
roleNoRole for the enrollment (StudentEnrollment, TeacherEnrollment, etc.)
user_idYesID of the user to enroll

Implementation Reference

  • MCP CallToolRequest handler for canvas_enroll_user: validates input arguments and calls CanvasClient.enrollUser method.
    case "canvas_enroll_user": {
      const enrollArgs = args as unknown as EnrollUserArgs;
      if (!enrollArgs.course_id || !enrollArgs.user_id) {
        throw new Error("Missing required fields: course_id and user_id");
      }
      const enrollment = await this.client.enrollUser(enrollArgs);
      return {
        content: [{ type: "text", text: JSON.stringify(enrollment, null, 2) }]
      };
    }
  • src/index.ts:436-454 (registration)
    Tool registration entry in the TOOLS array, including name, description, and JSON schema for input validation. Used by ListToolsRequest handler.
      name: "canvas_enroll_user",
      description: "Enroll a user in a course",
      inputSchema: {
        type: "object",
        properties: {
          course_id: { type: "number", description: "ID of the course" },
          user_id: { type: "number", description: "ID of the user to enroll" },
          role: { 
            type: "string", 
            description: "Role for the enrollment (StudentEnrollment, TeacherEnrollment, etc.)" 
          },
          enrollment_state: { 
            type: "string",
            description: "State of the enrollment (active, invited, etc.)"
          }
        },
        required: ["course_id", "user_id"]
      }
    },
  • CanvasClient.enrollUser: Makes the actual Canvas API POST request to enroll a user in a course.
    async enrollUser(args: EnrollUserArgs): Promise<CanvasEnrollment> {
      const { course_id, user_id, role = 'StudentEnrollment', enrollment_state = 'active' } = args;
      const response = await this.client.post(`/courses/${course_id}/enrollments`, {
        enrollment: {
          user_id,
          type: role,
          enrollment_state
        }
      });
      return response.data;
  • TypeScript type definition for EnrollUserArgs used in CanvasClient.enrollUser and MCP handler type casting.
    export interface EnrollUserArgs {
      course_id: number;
      user_id: number;
      role?: string;
      enrollment_state?: string;
      notify?: boolean;
      limit_privileges_to_course_section?: boolean;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Enroll') but lacks details on permissions required, whether the operation is idempotent, error conditions (e.g., duplicate enrollment), or what happens upon success (e.g., confirmation message). 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, direct sentence with no wasted words, making it easy to parse. It is front-loaded with the core action, though it could benefit from more detail given the tool's complexity.

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?

For a mutation tool with 4 parameters, no annotations, and no output schema, the description is insufficient. It lacks information on behavioral traits, error handling, return values, and usage context, 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 already documents all parameters (course_id, enrollment_state, role, user_id) with clear descriptions. The description adds no additional meaning beyond what the schema provides, such as explaining default values or constraints, resulting in a baseline score of 3.

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 clearly states the action ('Enroll') and target ('a user in a course'), making the purpose immediately understandable. However, it does not differentiate this tool from sibling tools like 'canvas_create_user' or 'canvas_update_user_profile', which might involve user-related operations in different contexts.

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. For example, it doesn't specify prerequisites (e.g., user and course must exist), compare to similar tools like 'canvas_update_user_profile', or indicate scenarios where enrollment might fail, leaving usage context unclear.

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

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

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