Skip to main content
The file tools let you explore and retrieve files attached to a Canvas course. Use list_course_folders to map the folder structure, list_course_files to list files (optionally filtered to a specific folder), and download_course_file to save a file to your local machine.

list_course_folders

Lists all folders in a course. Each folder object includes its ID, full path, parent folder ID, and counts of the files and subfolders it contains. Use the folder id returned here to filter list_course_files to a specific folder.

Parameters

course_id
string
required
The Canvas course ID.
limit
integer
default:"150"
Maximum number of folders to return. Accepted range: 1–300.

Return value

course_id
string
The course ID as provided.
count
integer
Number of folders returned.
folders
array

Examples

# List all folders in course 12345
canvas tool run list_course_folders --args '{"course_id": "12345"}'

# Limit to top 20 folders
canvas tool run list_course_folders --args '{"course_id": "12345", "limit": 20}'

list_course_files

Lists files in a course. Results can be narrowed by a search string and optionally sorted. Each file in the response includes a folder_id field you can use to correlate files with folders from list_course_folders.

Parameters

course_id
string
required
The Canvas course ID.
Substring filter matched against file names. Case-insensitive.
sort
string
Field to sort results by. Accepted values: name, size, created_at, updated_at, content_type, user.
order
string
Sort direction. Accepted values: asc, desc.
limit
integer
default:"100"
Maximum number of files to return. Accepted range: 1–300.

Return value

course_id
string
The course ID as provided.
count
integer
Number of files returned.
files
array

Examples

# List all files in course 12345
canvas tool run list_course_files --args '{"course_id": "12345"}'

# Search for PDF files
canvas tool run list_course_files --args '{"course_id": "12345", "search": ".pdf"}'

# Sort by size, largest first
canvas tool run list_course_files --args '{"course_id": "12345", "sort": "size", "order": "desc"}'

Browsing files by folder

list_course_files does not accept a folder_id parameter — it returns files across the entire course. To find files in a specific folder, first call list_course_folders to list all folders and their IDs, then cross-reference the folder_id field on each file in the list_course_files response.
1

List folders to find the folder ID

canvas tool run list_course_folders --args '{"course_id": "12345"}'
Each folder has an id field. Note the ID of the folder you want.
2

List files and filter by folder_id in results

canvas tool run list_course_files --args '{"course_id": "12345", "limit": 300}'
Filter the returned files array to entries where folder_id matches the target folder ID.

download_course_file

Downloads a course file and saves it to local temp storage. Returns the local file path so the calling agent or CLI command can read or process the file. If the file was already downloaded in a previous call, the cached copy is returned immediately without re-downloading unless force_refresh is set.

Parameters

course_id
string
required
The Canvas course ID.
file_id
string
required
The Canvas file ID. Obtain this from list_course_files.
force_refresh
boolean
default:"false"
When true, the existing cached file is deleted before downloading a fresh copy.

Local temp storage

Downloaded files are written to a temp directory managed by Canvas MCP. The exact path is returned in the local_path field of the response. The path format follows the pattern:
<temp_dir>/canvasmcp/<course_id>/<file_id>_<display_name>
The directory is created automatically on first download. Files persist across calls until force_refresh is used or the temp directory is cleared manually.
Read the local_path from the response to locate the file. The path is an absolute path on the machine running the MCP server.

Return value

course_id
string
The course ID as provided.
file_id
string
The file ID as provided.
display_name
string
The display name of the downloaded file.
local_path
string
Absolute path to the downloaded file on the local filesystem. Use this path to open, read, or further process the file.
size_bytes
integer
Size of the file on disk in bytes.
content_type
string
MIME type of the file.
already_present
boolean
true when the file was already cached and no network request was made. false when the file was freshly downloaded.

Examples

# Download file 55555 from course 12345
canvas tool run download_course_file --args '{"course_id": "12345", "file_id": "55555"}'

# Force a fresh download even if cached
canvas tool run download_course_file --args '{"course_id": "12345", "file_id": "55555", "force_refresh": true}'
Example response:
{
  "course_id": "12345",
  "file_id": "55555",
  "display_name": "Lecture 1 Slides.pdf",
  "local_path": "/tmp/canvasmcp/12345/55555_Lecture 1 Slides.pdf",
  "size_bytes": 2048000,
  "content_type": "application/pdf",
  "already_present": false
}

Course tools

Browse course metadata, syllabus, and enrollment.

Pages and modules

Navigate course pages, tabs, and module content.

Build docs developers (and LLMs) love