Skip to main content
Glama
hanweg

mcp-discord

by hanweg

create_text_channel

Add a new text channel to a Discord server by specifying the server ID, channel name, optional category ID, and topic. Simplify server organization with this integration tool.

Instructions

Create a new text channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_idNoOptional category ID to place channel in
nameYesChannel name
server_idYesDiscord server ID
topicNoOptional channel topic

Implementation Reference

  • Executes the create_text_channel tool: fetches guild, optional category, creates Discord text channel with given name, optional topic and category, returns success message with channel ID.
    elif name == "create_text_channel":
        guild = await discord_client.fetch_guild(int(arguments["server_id"]))
        category = None
        if "category_id" in arguments:
            category = guild.get_channel(int(arguments["category_id"]))
        
        channel = await guild.create_text_channel(
            name=arguments["name"],
            category=category,
            topic=arguments.get("topic"),
            reason="Channel created via MCP"
        )
        
        return [TextContent(
            type="text",
            text=f"Created text channel #{channel.name} (ID: {channel.id})"
        )]
  • Defines the input schema and description for the create_text_channel tool, specifying required parameters server_id and name, optional category_id and topic.
    Tool(
        name="create_text_channel",
        description="Create a new text channel",
        inputSchema={
            "type": "object",
            "properties": {
                "server_id": {
                    "type": "string",
                    "description": "Discord server ID"
                },
                "name": {
                    "type": "string",
                    "description": "Channel name"
                },
                "category_id": {
                    "type": "string",
                    "description": "Optional category ID to place channel in"
                },
                "topic": {
                    "type": "string",
                    "description": "Optional channel topic"
                }
            },
            "required": ["server_id", "name"]
        }
    ),
  • Registers the create_text_channel tool (and others) by returning it from the @app.list_tools() handler.
    @app.list_tools()
    async def list_tools() -> List[Tool]:
        """List available Discord tools."""
        return [
            # Server Information Tools
            Tool(
                name="get_server_info",
                description="Get information about a Discord server",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "server_id": {
                            "type": "string",
                            "description": "Discord server (guild) ID"
                        }
                    },
                    "required": ["server_id"]
                }
            ),
            Tool(
                name="get_channels",
                description="Get a list of all channels in a Discord server",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "server_id": {
                            "type": "string",
                            "description": "Discord server (guild) ID"
                        }
                    },
                    "required": ["server_id"]
                }
            ),
            Tool(
                name="list_members",
                description="Get a list of members in a server",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "server_id": {
                            "type": "string",
                            "description": "Discord server (guild) ID"
                        },
                        "limit": {
                            "type": "number",
                            "description": "Maximum number of members to fetch",
                            "minimum": 1,
                            "maximum": 1000
                        }
                    },
                    "required": ["server_id"]
                }
            ),
    
            # Role Management Tools
            Tool(
                name="add_role",
                description="Add a role to a user",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "server_id": {
                            "type": "string",
                            "description": "Discord server ID"
                        },
                        "user_id": {
                            "type": "string",
                            "description": "User to add role to"
                        },
                        "role_id": {
                            "type": "string",
                            "description": "Role ID to add"
                        }
                    },
                    "required": ["server_id", "user_id", "role_id"]
                }
            ),
            Tool(
                name="remove_role",
                description="Remove a role from a user",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "server_id": {
                            "type": "string",
                            "description": "Discord server ID"
                        },
                        "user_id": {
                            "type": "string",
                            "description": "User to remove role from"
                        },
                        "role_id": {
                            "type": "string",
                            "description": "Role ID to remove"
                        }
                    },
                    "required": ["server_id", "user_id", "role_id"]
                }
            ),
    
            # Channel Management Tools
            Tool(
                name="create_text_channel",
                description="Create a new text channel",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "server_id": {
                            "type": "string",
                            "description": "Discord server ID"
                        },
                        "name": {
                            "type": "string",
                            "description": "Channel name"
                        },
                        "category_id": {
                            "type": "string",
                            "description": "Optional category ID to place channel in"
                        },
                        "topic": {
                            "type": "string",
                            "description": "Optional channel topic"
                        }
                    },
                    "required": ["server_id", "name"]
                }
            ),
            Tool(
                name="delete_channel",
                description="Delete a channel",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "channel_id": {
                            "type": "string",
                            "description": "ID of channel to delete"
                        },
                        "reason": {
                            "type": "string",
                            "description": "Reason for deletion"
                        }
                    },
                    "required": ["channel_id"]
                }
            ),
    
            # Message Reaction Tools
            Tool(
                name="add_reaction",
                description="Add a reaction to a message",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "channel_id": {
                            "type": "string",
                            "description": "Channel containing the message"
                        },
                        "message_id": {
                            "type": "string",
                            "description": "Message to react to"
                        },
                        "emoji": {
                            "type": "string",
                            "description": "Emoji to react with (Unicode or custom emoji ID)"
                        }
                    },
                    "required": ["channel_id", "message_id", "emoji"]
                }
            ),
            Tool(
                name="add_multiple_reactions",
                description="Add multiple reactions to a message",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "channel_id": {
                            "type": "string",
                            "description": "Channel containing the message"
                        },
                        "message_id": {
                            "type": "string",
                            "description": "Message to react to"
                        },
                        "emojis": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "description": "Emoji to react with (Unicode or custom emoji ID)"
                            },
                            "description": "List of emojis to add as reactions"
                        }
                    },
                    "required": ["channel_id", "message_id", "emojis"]
                }
            ),
            Tool(
                name="remove_reaction",
                description="Remove a reaction from a message",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "channel_id": {
                            "type": "string",
                            "description": "Channel containing the message"
                        },
                        "message_id": {
                            "type": "string",
                            "description": "Message to remove reaction from"
                        },
                        "emoji": {
                            "type": "string",
                            "description": "Emoji to remove (Unicode or custom emoji ID)"
                        }
                    },
                    "required": ["channel_id", "message_id", "emoji"]
                }
            ),
            Tool(
                name="send_message",
                description="Send a message to a specific channel",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "channel_id": {
                            "type": "string",
                            "description": "Discord channel ID"
                        },
                        "content": {
                            "type": "string",
                            "description": "Message content"
                        }
                    },
                    "required": ["channel_id", "content"]
                }
            ),
            Tool(
                name="read_messages",
                description="Read recent messages from a channel",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "channel_id": {
                            "type": "string",
                            "description": "Discord channel ID"
                        },
                        "limit": {
                            "type": "number",
                            "description": "Number of messages to fetch (max 100)",
                            "minimum": 1,
                            "maximum": 100
                        }
                    },
                    "required": ["channel_id"]
                }
            ),
            Tool(
                name="get_user_info",
                description="Get information about a Discord user",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "user_id": {
                            "type": "string",
                            "description": "Discord user ID"
                        }
                    },
                    "required": ["user_id"]
                }
            ),
            Tool(
                name="moderate_message",
                description="Delete a message and optionally timeout the user",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "channel_id": {
                            "type": "string",
                            "description": "Channel ID containing the message"
                        },
                        "message_id": {
                            "type": "string",
                            "description": "ID of message to moderate"
                        },
                        "reason": {
                            "type": "string",
                            "description": "Reason for moderation"
                        },
                        "timeout_minutes": {
                            "type": "number",
                            "description": "Optional timeout duration in minutes",
                            "minimum": 0,
                            "maximum": 40320  # Max 4 weeks
                        }
                    },
                    "required": ["channel_id", "message_id", "reason"]
                }
            ),
            Tool(
                name="list_servers",
                description="Get a list of all Discord servers the bot has access to with their details such as name, id, member count, and creation date.",
                inputSchema={
                    "type": "object",
                    "properties": {},
                    "required": []
                }
            )
        ]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hanweg/mcp-discord'

If you have feedback or need assistance with the MCP directory API, please join our Discord server