invites_get
Look up a Discord invite by its code (or full URL after stripping the prefix).
When to use
Section titled “When to use”- Inspect an invite before deleting or sharing.
- Resolve which guild/channel an invite points at.
When not to use
Section titled “When not to use”- Listing all invites for a channel → use
invites_list_channel.
MCP call example
Section titled “MCP call example”Tool-authored shorthand:
{code:"abc123def", with_counts:true}
{ "name": "invites_get", "arguments": { "code": "example" }}| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
code | string | yes | min length: 1; max length: 32 | Invite code (the bit after https://discord.gg/) |
with_counts | boolean | no | Include approximate member/presence counts | |
with_expiration | boolean | no | Include expires_at field | |
guild_scheduled_event_id | string | no | pattern: ^\d{17,20}$ | Surface a specific scheduled event tied to the invite |
Complete input JSON Schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "code": { "type": "string", "minLength": 1, "maxLength": 32, "description": "Invite code (the bit after https://discord.gg/)" }, "with_counts": { "description": "Include approximate member/presence counts", "type": "boolean" }, "with_expiration": { "description": "Include expires_at field", "type": "boolean" }, "guild_scheduled_event_id": { "description": "Surface a specific scheduled event tied to the invite", "type": "string", "pattern": "^\\d{17,20}$" } }, "required": [ "code" ]}Returns
Section titled “Returns”Projected invite shape with optional counts. Guild and channel names remain raw Discord data; untrusted_names provides a separately fenced copy.
Example structured result
Section titled “Example structured result”{ "code": "example", "channel_id": "123456789012345678", "untrusted_names": "Example name"}Output schema
Section titled “Output schema”| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
code | string | yes | min length: 1; max length: 32 | Discord invite code (base62, NOT a snowflake) |
channel_id | string | null | yes | ||
guild_id | string | no | pattern: ^\d{17,20}$ | Discord guild (server) ID |
inviter_id | string | no | pattern: ^\d{17,20}$ | Discord user ID |
inviter_name | string | no | ||
expires_at | string | null | no | ||
approximate_member_count | number | no | ||
approximate_presence_count | number | no | ||
untrusted_names | string | yes |
Complete output JSON Schema
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "properties": { "code": { "type": "string", "minLength": 1, "maxLength": 32, "description": "Discord invite code (base62, NOT a snowflake)" }, "channel_id": { "anyOf": [ { "type": "string", "pattern": "^\\d{17,20}$", "description": "Discord channel ID (snowflake)" }, { "type": "null" } ] }, "guild_id": { "type": "string", "pattern": "^\\d{17,20}$", "description": "Discord guild (server) ID" }, "inviter_id": { "type": "string", "pattern": "^\\d{17,20}$", "description": "Discord user ID" }, "inviter_name": { "type": "string" }, "expires_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "approximate_member_count": { "type": "number" }, "approximate_presence_count": { "type": "number" }, "untrusted_names": { "type": "string" } }, "required": [ "code", "channel_id", "untrusted_names" ], "additionalProperties": false}Annotations
Section titled “Annotations”| Property | Value |
|---|---|
| Read-only | yes |
| Destructive | no |
| Idempotent | yes |
| Open-world | yes |
| Confirmation required | no |
Access and common errors
Section titled “Access and common errors”- The
invitescategory 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/invites/get.ts