delete_announcements_by_criteria
Remove Canvas course announcements based on specific criteria such as title content, posting date ranges, or regular expression patterns to manage announcement content efficiently.
Instructions
Delete announcements matching specific criteria.
Args:
course_identifier: The Canvas course code or ID
criteria: Dict with search criteria:
- "title_contains": str - Delete if title contains this text
- "older_than": str - Delete if posted before this date (ISO format)
- "newer_than": str - Delete if posted after this date (ISO format)
- "title_regex": str - Delete if title matches regex pattern
limit: Maximum number of announcements to delete (safety limit)
dry_run: If True, show what would be deleted without actually deleting
Returns:
String with operation results showing matched and deleted announcements
Example usage:
# Delete all announcements older than 30 days
from datetime import datetime, timedelta
results = delete_announcements_by_criteria(
"60366",
criteria={
"older_than": (datetime.now() - timedelta(days=30)).isoformat(),
"title_contains": "reminder"
},
limit=10,
dry_run=False
)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
course_identifier | Yes | ||
criteria | Yes | ||
dry_run | No | ||
limit | No |
Input Schema (JSON Schema)
{
"properties": {
"course_identifier": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
],
"title": "Course Identifier"
},
"criteria": {
"additionalProperties": true,
"title": "Criteria",
"type": "object"
},
"dry_run": {
"default": true,
"title": "Dry Run",
"type": "boolean"
},
"limit": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Limit"
}
},
"required": [
"course_identifier",
"criteria"
],
"type": "object"
}