discord_login
Authenticate with Discord using a configured token to enable AI assistants to interact with Discord platforms for messaging, channel management, and webhook handling.
Instructions
Logs in to Discord using the configured token
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| random_string | No |
Implementation Reference
- src/index.ts:475-504 (handler)The main handler for the discord_login tool. Parses optional random_string arg (unused), checks if client is ready, logs in using client.login(config.DISCORD_TOKEN), returns success message with user tag or error.case "discord_login": { const { random_string } = DiscordLoginSchema.parse(args); try { // Check if already logged in if (client.isReady()) { return { content: [{ type: "text", text: `Already logged in as ${client.user?.tag}` }] }; } // Try to login await client.login(config.DISCORD_TOKEN); return { content: [{ type: "text", text: `Successfully logged in as ${client.user?.tag}` }] }; } catch (error) { return { content: [{ type: "text", text: `Login failed: ${error}` }], isError: true }; } }
- src/index.ts:72-74 (schema)Zod validation schema for the tool's input: optional random_string.const DiscordLoginSchema = z.object({ random_string: z.string().optional() });
- src/index.ts:195-204 (registration)Tool registration in the MCP server's listTools response, defining name, description, and input schema matching the Zod schema.{ name: "discord_login", description: "Logs in to Discord using the configured token", inputSchema: { type: "object", properties: { random_string: { type: "string" } }, required: [] }