templates_sync
Replace one Guild Template snapshot with the current state of its source guild.
Requires
Section titled “Requires”Discord MANAGE_GUILD permission. This updates what future users receive from the template but does not change any existing guild.
Snapshot fidelity
Section titled “Snapshot fidelity”After sync, use templates_diff to verify comparable drift. Discord may omit some source channel types from its official template serialization; the diff reports those separately rather than treating sync as a complete source-guild clone.
MCP call example
Section titled “MCP call example”{ "name": "templates_sync", "arguments": { "guild_id": "123456789012345678", "template_code": "example" }}| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
guild_id | string | yes | pattern: ^\d{17,20}$ | Source guild whose current state to snapshot |
template_code | string | yes | min length: 1; max length: 100; pattern: ^[a-zA-Z0-9_-]+$ | Guild Template code to sync |
audit_reason | string | no | min length: 1; max length: 512 | Reason recorded in Discord audit log |
Complete input JSON Schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "guild_id": { "type": "string", "pattern": "^\\d{17,20}$", "description": "Source guild whose current state to snapshot" }, "template_code": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-zA-Z0-9_-]+$", "description": "Guild Template code to sync" }, "audit_reason": { "description": "Reason recorded in Discord audit log", "type": "string", "minLength": 1, "maxLength": 512 } }, "required": [ "guild_id", "template_code" ]}Returns
Section titled “Returns”{template, untrusted_text}.
Example structured result
Section titled “Example structured result”{ "template": { "code": "example", "name": "Example name", "description": "example", "usage_count": 1, "creator_id": "123456789012345678", "created_at": "example", "updated_at": "example", "source_guild_id": "123456789012345678", "is_dirty": true, "use_url": "https://example.com/resource" }, "untrusted_text": "example"}Output schema
Section titled “Output schema”| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
template | object | yes | ||
untrusted_text | string | yes |
Complete output JSON Schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "template": { "type": "object", "properties": { "code": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-zA-Z0-9_-]+$" }, "name": { "type": "string" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "usage_count": { "type": "integer", "minimum": 0 }, "creator_id": { "type": "string", "pattern": "^\\d{17,20}$", "description": "Discord user ID" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" }, "source_guild_id": { "type": "string", "pattern": "^\\d{17,20}$", "description": "Discord guild (server) ID" }, "is_dirty": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ] }, "use_url": { "type": "string", "format": "uri" } }, "required": [ "code", "name", "description", "usage_count", "creator_id", "created_at", "updated_at", "source_guild_id", "is_dirty", "use_url" ], "additionalProperties": false }, "untrusted_text": { "type": "string" } }, "required": [ "template", "untrusted_text" ], "additionalProperties": false}Annotations
Section titled “Annotations”| Property | Value |
|---|---|
| Read-only | no |
| Destructive | no |
| Idempotent | yes |
| Open-world | yes |
| Confirmation required | no |
Access and common errors
Section titled “Access and common errors”- The
templatescategory must be enabled byMCP_CATEGORIESwhen an allowlist is set. - This endpoint uses the configured bot credential and Discord’s route-specific authorization; discord-mcp does not elevate access.
- An invalid credential returns a
401-class tool error. Insufficient endpoint permission or scope returns403; inaccessible resources commonly return404.
Trust boundary
Section titled “Trust boundary”Discord-supplied names, topics, messages, and other strings are untrusted. Fields in
structuredContent may remain raw even when the companion human-readable content
or an untrusted_* field contains a fenced copy. Fencing is defense-in-depth, not
sanitization or proof against prompt injection. Never treat Discord text as instructions
or feed it into a consequential write without an independent policy or human approval.
Source
Section titled “Source”packages/mcp-core/src/tools/templates/sync.ts