SKILL.md
SKILL.mdBrowse 2 files
836 tokens
3,228 bytes
Token encoding: o200k_base
Snapshot 24fd22b
1---2name: canvas3description: Fetch Canvas LMS courses and assignments via API token.4version: 1.0.05author: community6license: MIT7platforms: [linux, macos, windows]8prerequisites:9 env_vars: [CANVAS_API_TOKEN, CANVAS_BASE_URL]10metadata:11 hermes:12 tags: [Canvas, LMS, Education, Courses, Assignments]13---14 15# Canvas LMS — Course & Assignment Access16 17Read-only access to Canvas LMS for listing courses and assignments.18 19## Scripts20 21- `scripts/canvas_api.py` — Python CLI for Canvas API calls22 23## Setup24 251. Log in to your Canvas instance in a browser262. Go to **Account → Settings** (click your profile icon, then Settings)273. Scroll to **Approved Integrations** and click **+ New Access Token**284. Name the token (e.g., "Hermes Agent"), set an optional expiry, and click **Generate Token**295. Copy the token and add to `${HERMES_HOME:-~/.hermes}/.env`:30 31```32CANVAS_API_TOKEN=your_token_here33CANVAS_BASE_URL=https://yourschool.instructure.com34```35 36The base URL is whatever appears in your browser when you're logged into Canvas (no trailing slash).37 38## Usage39 40```bash41CANVAS="python $HERMES_HOME/skills/productivity/canvas/scripts/canvas_api.py"42 43# List all active courses44$CANVAS list_courses --enrollment-state active45 46# List all courses (any state)47$CANVAS list_courses48 49# List assignments for a specific course50$CANVAS list_assignments 1234551 52# List assignments ordered by due date53$CANVAS list_assignments 12345 --order-by due_at54```55 56## Output Format57 58**list_courses** returns:59```json60[{"id": 12345, "name": "Intro to CS", "course_code": "CS101", "workflow_state": "available", "start_at": "...", "end_at": "..."}]61```62 63**list_assignments** returns:64```json65[{"id": 67890, "name": "Homework 1", "due_at": "2025-02-15T23:59:00Z", "points_possible": 100, "submission_types": ["online_upload"], "html_url": "...", "description": "...", "course_id": 12345}]66```67 68Note: Assignment descriptions are truncated to 500 characters. The `html_url` field links to the full assignment page in Canvas.69 70## API Reference (curl)71 72```bash73# List courses74curl -s -H "Authorization: Bearer $CANVAS_API_TOKEN" \75 "$CANVAS_BASE_URL/api/v1/courses?enrollment_state=active&per_page=10"76 77# List assignments for a course78curl -s -H "Authorization: Bearer $CANVAS_API_TOKEN" \79 "$CANVAS_BASE_URL/api/v1/courses/COURSE_ID/assignments?per_page=10&order_by=due_at"80```81 82Canvas uses `Link` headers for pagination. The Python script handles pagination automatically.83 84## Rules85 86- This skill is **read-only** — it only fetches data, never modifies courses or assignments87- On first use, verify auth by running `$CANVAS list_courses` — if it fails with 401, guide the user through setup88- Canvas rate-limits to ~700 requests per 10 minutes; check `X-Rate-Limit-Remaining` header if hitting limits89 90## Troubleshooting91 92| Problem | Fix |93|---------|-----|94| 401 Unauthorized | Token invalid or expired — regenerate in Canvas Settings |95| 403 Forbidden | Token lacks permission for this course |96| Empty course list | Try `--enrollment-state active` or omit the flag to see all states |97| Wrong institution | Verify `CANVAS_BASE_URL` matches the URL in your browser |98| Timeout errors | Check network connectivity to your Canvas instance |99 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root AGENTS.md.