delete_invite
Remove Discord server invites by providing an invite code to manage access and maintain server security.
Instructions
Delete an invite
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inviteCode | Yes | The invite code to delete | |
| reason | No | Reason for deleting |
Implementation Reference
- src/tools/invite-tools.ts:150-164 (handler)The handler function that implements the core logic of the delete_invite tool: fetches the Discord client, retrieves the invite, deletes it with optional reason, wraps in error handling, and formats the response.async ({ inviteCode, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const invite = await client.fetchInvite(inviteCode); await invite.delete(reason); return { inviteCode, message: 'Invite deleted successfully' }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; }
- src/tools/invite-tools.ts:146-149 (schema)Zod input schema defining parameters for the delete_invite tool: required inviteCode and optional reason.{ inviteCode: z.string().describe('The invite code to delete'), reason: z.string().optional().describe('Reason for deleting'), },
- src/tools/invite-tools.ts:143-165 (registration)MCP server.tool registration for delete_invite, including name, description, schema, and handler function.server.tool( 'delete_invite', 'Delete an invite', { inviteCode: z.string().describe('The invite code to delete'), reason: z.string().optional().describe('Reason for deleting'), }, async ({ inviteCode, reason }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const invite = await client.fetchInvite(inviteCode); await invite.delete(reason); return { inviteCode, message: 'Invite deleted successfully' }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );