Skip to main content
Documentation

Uploading files

Files travel by URL, not through the chat

Assistants cannot push a file's contents through a conversation. MCP tool arguments are JSON written by the model itself, so a binary would have to travel base64-encoded as generated text — impossible beyond a few tens of kilobytes, and clients like Claude Desktop never attach conversation files to tool calls anyway.

That's why files reach Moodle by URL: you give the assistant a public HTTPS link and your own Moodle server downloads the file directly (up to 512 MiB, with Moodle's SSRF protections). The file never passes through the chat.

Adding a file to a course

  • local_mcpconnector_create_resource: adds any file (PDF, DOCX, image, video…) to a course as a File resource.
  • local_mcpconnector_create_scorm: creates a SCORM activity from a package zip.

Both tools ship with the plugin since version 1.0.

Ask in plain language — "add this PDF to the Biology course as a resource: https://…" — and the assistant will pick the right tool.

The link must return the file itself, not a web page wrapping it:

SourceWhat to use
Google Drivehttps://drive.google.com/uc?export=download&id=FILE_ID; the normal share link returns a page, and very large files hit a confirmation step the server can't click through
DropboxAppend ?dl=1 to the share link
GitHubUse the raw.githubusercontent.com URL

Any HTTPS URL your Moodle can reach works, including your own web server.

Files on the assistant's machine

When the file lives where the assistant runs — a SCORM package it just built, a PDF it generated — there's no public URL to give it. Use moodle_request_file_upload:

  1. The tool returns a temporary upload URL.
  2. The assistant uploads the file with the curl command it gets back.
  3. It passes the resulting fileUrl to create_resource or create_scorm.

Both URLs expire and the file is deleted after 30 minutes. It's a transfer channel, not storage: don't use it to keep anything.

Upload problems

  • "Could not download the file": the URL returns HTML instead of the file, or isn't publicly reachable. Test it with curl -IL url from outside your network.
  • The tool isn't available: your plugin is outdated. Update it in Moodle.
  • The assistant says it can't upload files: it hasn't found the tool. Asking it to search its Moodle tools for "upload" usually unblocks it.