Skip to main content
Glama

modify_thread

Update Discord thread settings including name, archive status, lock state, slowmode, auto-archive duration, and tags to manage server conversations.

Instructions

Modify a thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
threadIdYesThe ID of the thread
nameNoNew name
archivedNoArchive/unarchive the thread
lockedNoLock/unlock the thread
autoArchiveDurationNoAuto archive minutes
rateLimitPerUserNoSlowmode in seconds (0-21600)
appliedTagsNoApplied tags (forum posts only)
reasonNoReason for modifying

Implementation Reference

  • The handler function that fetches the Discord thread and edits it with the provided parameters (name, archived, locked, autoArchiveDuration, rateLimitPerUser, appliedTags, reason) using thread.edit() and returns the updated thread info or error.
    async ({ guildId, threadId, name, archived, locked, autoArchiveDuration, rateLimitPerUser, appliedTags, reason }) => { 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'); } const archiveDurationMap: Record<string, ThreadAutoArchiveDuration> = { '60': ThreadAutoArchiveDuration.OneHour, '1440': ThreadAutoArchiveDuration.OneDay, '4320': ThreadAutoArchiveDuration.ThreeDays, '10080': ThreadAutoArchiveDuration.OneWeek, }; const editData: Record<string, unknown> = {}; if (name !== undefined) editData.name = name; if (archived !== undefined) editData.archived = archived; if (locked !== undefined) editData.locked = locked; if (autoArchiveDuration) editData.autoArchiveDuration = archiveDurationMap[autoArchiveDuration]; if (rateLimitPerUser !== undefined) editData.rateLimitPerUser = rateLimitPerUser; if (appliedTags) editData.appliedTags = appliedTags; if (reason) editData.reason = reason; const updated = await thread.edit(editData); return { id: updated.id, name: updated.name, archived: updated.archived, locked: updated.locked, message: 'Thread updated successfully', }; }); 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 for modifying a thread: guildId, threadId (required), and optional fields for name, archived status, locked status, auto-archive duration, rate limit, tags, and reason.
    guildId: z.string().describe('The ID of the server (guild)'), threadId: z.string().describe('The ID of the thread'), name: z.string().optional().describe('New name'), archived: z.boolean().optional().describe('Archive/unarchive the thread'), locked: z.boolean().optional().describe('Lock/unlock the thread'), autoArchiveDuration: z.enum(['60', '1440', '4320', '10080']).optional().describe('Auto archive minutes'), rateLimitPerUser: z.number().optional().describe('Slowmode in seconds (0-21600)'), appliedTags: z.array(z.string()).optional().describe('Applied tags (forum posts only)'), reason: z.string().optional().describe('Reason for modifying'), },
  • Registers the 'modify_thread' tool on the MCP server using server.tool(), providing name, description, input schema, and handler function.
    server.tool( 'modify_thread', 'Modify a thread', { guildId: z.string().describe('The ID of the server (guild)'), threadId: z.string().describe('The ID of the thread'), name: z.string().optional().describe('New name'), archived: z.boolean().optional().describe('Archive/unarchive the thread'), locked: z.boolean().optional().describe('Lock/unlock the thread'), autoArchiveDuration: z.enum(['60', '1440', '4320', '10080']).optional().describe('Auto archive minutes'), rateLimitPerUser: z.number().optional().describe('Slowmode in seconds (0-21600)'), appliedTags: z.array(z.string()).optional().describe('Applied tags (forum posts only)'), reason: z.string().optional().describe('Reason for modifying'), }, async ({ guildId, threadId, name, archived, locked, autoArchiveDuration, rateLimitPerUser, appliedTags, reason }) => { 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'); } const archiveDurationMap: Record<string, ThreadAutoArchiveDuration> = { '60': ThreadAutoArchiveDuration.OneHour, '1440': ThreadAutoArchiveDuration.OneDay, '4320': ThreadAutoArchiveDuration.ThreeDays, '10080': ThreadAutoArchiveDuration.OneWeek, }; const editData: Record<string, unknown> = {}; if (name !== undefined) editData.name = name; if (archived !== undefined) editData.archived = archived; if (locked !== undefined) editData.locked = locked; if (autoArchiveDuration) editData.autoArchiveDuration = archiveDurationMap[autoArchiveDuration]; if (rateLimitPerUser !== undefined) editData.rateLimitPerUser = rateLimitPerUser; if (appliedTags) editData.appliedTags = appliedTags; if (reason) editData.reason = reason; const updated = await thread.edit(editData); return { id: updated.id, name: updated.name, archived: updated.archived, locked: updated.locked, message: 'Thread updated successfully', }; }); 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