delete_invite
Remove a Discord invite link by providing its code to manage server access and maintain 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:143-165 (registration)Registration and implementation of the delete_invite tool, including schema, handler logic to fetch and delete the Discord invite.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) }] }; } );
- src/tools/invite-tools.ts:150-163 (handler)Handler function that executes the delete_invite tool: fetches the invite via Discord client and deletes it with optional reason.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:147-149 (schema)Input schema for delete_invite tool using Zod: requires inviteCode, optional reason.inviteCode: z.string().describe('The invite code to delete'), reason: z.string().optional().describe('Reason for deleting'), },
- src/index.ts:62-62 (registration)Calls registerInviteTools to register all invite tools including delete_invite.registerInviteTools(server);