update_activity
Change an existing activity through Moodle's own form: name, description, a page's or label's content, a URL's target, visibility, access restrictions, completion, a file resource's or folder's files (add, remove by their path as get_activity_settings lists them, or replace all), a SCORM's packag...
This record as markdown: /tools/falkenslab-moodle-mcp/update-activity.md
What update_activity does on Moodle
AI agents use update_activity to create or update resources in Moodle, usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your Moodle environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | — | A URL resource's target |
name | string | — | |
embed | array | — | Absolute local files (images…) to embed in the HTML, which names each by its file name: <img src="shot.png"> |
files | object | — | A file resource's or folder's files; untouched when missing |
content | string | — | A page's content, or a label's text (HTML) |
package | string | — | A SCORM's new package: an absolute local path to a .zip, replacing the current one in place |
settings | object | — | Any other form field by its name in Moodle's activity form, e.g. {"duedate[enabled]": true, "duedate[day]": 12, "grade[modgrade_point]": 10} |
activityId | integer | Yes | The activity's id (course module id), as get_course_structure gives it |
completion | object | — | When it counts as complete |
visibility | string | — | "stealth": hidden from the course page but available by link, where the site allows it |
description | string | — | The description (HTML), shown on the activity's page |
restrictions | object | — | When students can open it ({ conditions: [] } removes them) |
Parameters from the server's own tool schema.
Why update_activity is rated Medium
An AI agent can call update_activity faster than any human can review: one bad instruction and it creates or modifies resources in Moodle by the hundred, each call as confident as the last.
Risk signalsAccepts URL/endpoint input (url) · Accepts raw HTML/template content (content) · High parameter count (33 properties)
Attacks that exploit this kind of access
The rule that runs update_activity safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Moodle, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For update_activity, this is the rule to start with:
update_activity stays usable, but capped: an agent stuck in a loop can't make hundreds of changes a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Moodle, apply this rule, and every update_activity call is checked against it from then on.
Questions about update_activity
Change an existing activity through Moodle's own form: name, description, a page's or label's content, a URL's target, visibility, access restrictions, completion, a file resource's or folder's files (add, remove by their path as get_activity_settings lists them, or replace all), a SCORM's package (replaced in place: the activity keeps its id, settings and grade item; attempts stay in the SCOs the new package keeps, by their identifier, and go with the SCOs it drops), or any other setting by its form field name in settings. Only what is given changes. Returns the course structure, and a SCORM as get_scorm reads it after a new package. Changes the course: confirm with the person first. It is categorised as a Write tool in the Moodle MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.
update_activity accepts 12 parameters: url, name, embed, files, content, package, settings, activityId, completion, visibility, description, restrictions. Required: activityId. The full parameter table on this page comes from the server's own tool schema.
Register the Moodle MCP server in PolicyLayer and add a rule for update_activity: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Moodle. Nothing to install.
update_activity is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.
Yes. Add a rate_limit block to the update_activity rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for update_activity. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
update_activity is provided by the Moodle MCP server (@falkenslab/moodle-mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Moodle, and thousands of servers like it.
This server
Across the catalogue