Skip to content

v1.0.7 - File Upload Support

Choose a tag to compare

@vishalsachdev vishalsachdev released this 21 Jan 05:08

What's New

File Upload Tool 📁

New upload_course_file tool enables uploading files from the local filesystem to Canvas courses.

Features

  • Canvas 3-step upload protocol - Handles the complete upload flow transparently
  • Comprehensive validation - File existence, readability, size limits (100MB), extension whitelist
  • MIME type detection - Automatic content-type detection from file extension
  • Filename sanitization - Cleans special characters for safe Canvas storage
  • Security-first - Whitelist approach blocks potentially dangerous file types

Usage Example

# Upload a PDF to Canvas
upload_course_file("CS101", "/path/to/syllabus.pdf")
# → "✅ Uploaded! File ID: 12345, Name: syllabus.pdf"

# Then add to a module
add_module_item("CS101", module_id, "File", content_id=12345)

# Or attach to a message
send_conversation("CS101", ["student_id"], "Subject", "Body", attachment_ids=["12345"])

Parameters

  • course_identifier - Course code or ID
  • file_path - Local filesystem path to upload
  • folder_path (optional) - Canvas folder destination
  • display_name (optional) - Override filename in Canvas
  • on_duplicate - "rename" (default) or "overwrite"

New Files

  • src/canvas_mcp/core/file_validation.py - Validation utilities
  • src/canvas_mcp/tools/files.py - Upload tool implementation
  • tests/tools/test_files.py - 33 unit tests

Testing

  • 33 new tests for file upload functionality
  • 183 total tests passing

Full Changelog: v1.0.6...v1.0.7