Skip to main content
Glama

add_thread_member

Add a user to a Discord thread by providing guild, thread, and user IDs to manage thread participation.

Instructions

Add a member to a thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
threadIdYesThe ID of the thread
userIdYesThe ID of the user to add

Implementation Reference

  • Handler function that fetches the thread and adds the specified user as a member using thread.members.add(userId). Wraps in error handling and returns JSON response.
    async ({ guildId, threadId, userId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const thread = await guild.channels.fetch(threadId); if (!thread || !thread.isThread()) { throw new Error('Thread not found'); } await thread.members.add(userId); return { threadId, userId, message: 'Member added to thread' }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; }
  • Zod input schema defining parameters: guildId, threadId, userId.
    { guildId: z.string().describe('The ID of the server (guild)'), threadId: z.string().describe('The ID of the thread'), userId: z.string().describe('The ID of the user to add'), },
  • Tool registration call using server.tool() with name 'add_thread_member', description, input schema, and handler function.
    'add_thread_member', 'Add a member to a thread', { guildId: z.string().describe('The ID of the server (guild)'), threadId: z.string().describe('The ID of the thread'), userId: z.string().describe('The ID of the user to add'), }, async ({ guildId, threadId, userId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const thread = await guild.channels.fetch(threadId); if (!thread || !thread.isThread()) { throw new Error('Thread not found'); } await thread.members.add(userId); return { threadId, userId, message: 'Member added to thread' }; }); if (!result.success) { return { content: [{ type: 'text', text: result.error }], isError: true }; } return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] }; } );

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/scarecr0w12/discord-mcp'

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