Skip to main content
Glama

get_pinned_messages

Retrieve all pinned messages from a specific Discord channel to access important announcements and key information.

Instructions

Get all pinned messages in a channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guildIdYesThe ID of the server (guild)
channelIdYesThe ID of the channel

Implementation Reference

  • Registration of the 'get_pinned_messages' tool. Includes input schema (guildId and channelId) and the handler function that fetches and returns pinned messages from the specified Discord channel using channel.messages.fetchPinned().
    'get_pinned_messages', 'Get all pinned messages in a channel', { guildId: z.string().describe('The ID of the server (guild)'), channelId: z.string().describe('The ID of the channel'), }, async ({ guildId, channelId }) => { const result = await withErrorHandling(async () => { const client = await getDiscordClient(); const guild = await client.guilds.fetch(guildId); const channel = await guild.channels.fetch(channelId); if (!isMessageableChannel(channel)) { throw new Error('Channel does not support messages'); } const pinned = await channel.messages.fetchPinned(); return pinned.map((msg) => ({ id: msg.id, content: msg.content, authorId: msg.author.id, authorUsername: msg.author.username, createdAt: msg.createdAt.toISOString(), })); }); 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