Skip to main content
Glama

Get My Courses

get_my_courses

Retrieve your enrolled Brightspace courses including names, codes, and IDs. Use this to view current classes or obtain course identifiers for other queries.

Instructions

Fetch your enrolled Brightspace courses with names, codes, and IDs. Use this when the user asks about their courses, enrolled classes, what they're taking this semester, or needs a course ID for other queries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
activeOnlyNoOnly return currently active courses

Implementation Reference

  • The registerGetMyCourses function that registers and implements the get_my_courses tool. It calls server.registerTool with the tool name, metadata, and an async handler that fetches Brightspace enrollments via the D2L API, maps them to a clean structure, applies a course filter, and returns the result.
    export function registerGetMyCourses(
      server: McpServer,
      apiClient: D2LApiClient,
      config: AppConfig
    ): void {
      server.registerTool(
        "get_my_courses",
        {
          title: "Get My Courses",
          description:
            "Fetch your enrolled Brightspace courses with names, codes, and IDs. Use this when the user asks about their courses, enrolled classes, what they're taking this semester, or needs a course ID for other queries.",
          inputSchema: GetMyCoursesSchema,
        },
        async (args: any) => {
          try {
            log("DEBUG", "get_my_courses tool called", { args });
    
            // Parse and validate input
            const { activeOnly } = GetMyCoursesSchema.parse(args);
    
            // Build path - orgUnitTypeId=3 means "Course Offering" type
            const path = apiClient.lp(
              `/enrollments/myenrollments/?orgUnitTypeId=3${activeOnly ? "&isActive=true" : ""}`
            );
    
            // Fetch enrollments
            const response = await apiClient.get<EnrollmentResponse>(path, {
              ttl: DEFAULT_CACHE_TTLS.enrollments,
            });
    
            // Check for pagination
            if (response.PagingInfo?.HasMoreItems) {
              log(
                "WARN",
                "get_my_courses: Pagination detected but not implemented. Some courses may be missing.",
                { hasMore: true }
              );
            }
    
            // Map to clean objects and apply course filter
            const courses = applyCourseFilter(
              response.Items.map((item) => ({
                id: item.OrgUnit.Id,
                name: item.OrgUnit.Name,
                code: item.OrgUnit.Code,
                role: item.Access.ClasslistRoleName,
                isActive: item.Access.IsActive,
                lastAccessed: item.Access.LastAccessed,
              })),
              config.courseFilter
            );
    
            log("INFO", `get_my_courses: Retrieved ${courses.length} courses`);
            return toolResponse(courses);
          } catch (error) {
            return sanitizeError(error);
          }
        }
      );
    }
  • Zod schema definition for GetMyCoursesSchema, defining activeOnly as an optional boolean parameter defaulting to true.
    export const GetMyCoursesSchema = z.object({
      activeOnly: z.boolean().default(true).describe("Only return currently active courses"),
    });
  • src/index.ts:179-179 (registration)
    Registration call in main index.ts where registerGetMyCourses is invoked with server, apiClient, and config.
    registerGetMyCourses(server, apiClient, config);
  • src/tools/index.ts:8-8 (registration)
    Barrel export re-exporting registerGetMyCourses from get-my-courses.js.
    export { registerGetMyCourses } from "./get-my-courses.js";
  • src/index.ts:21-22 (registration)
    Import of registerGetMyCourses in main index.ts.
    registerGetMyCourses,
    registerGetUpcomingDueDates,
Behavior4/5

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

Though no annotations exist, the description indicates a read operation ('fetch') and specifies it returns data for the current user. It could mention if authentication is required or any rate limits, but the core behavior is clear.

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?

Two sentences that are front-loaded with purpose followed by usage guidance. No redundant information.

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

Completeness5/5

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

Given the simple input schema and no output schema, the description adequately explains the return content (names, codes, IDs) and the activeOnly parameter. Sufficient for the tool's complexity.

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 coverage is 100% with a single boolean parameter already described. The description adds no extra meaning about the parameter beyond the schema definition.

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

Purpose5/5

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

The description clearly states the tool fetches the user's enrolled Brightspace courses with specific fields (names, codes, IDs). It is distinct from sibling tools that handle announcements, assignments, etc.

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

Usage Guidelines4/5

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

Explicit use cases are provided: user asks about courses, enrolled classes, semester schedule, or needs a course ID. While no alternative tools are mentioned, the context makes it clear this is the only course-listing tool.

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/RohanMuppa/brightspace-mcp-server'

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