Skip to main content
Glama

invite_to_channel

Add users to a Slack channel by providing their user IDs and the target channel ID.

Instructions

Invite users to a channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYesChannel ID
usersYesArray of user IDs to invite

Implementation Reference

  • The main handler function for the 'invite_to_channel' tool. It validates input using inviteToChannelSchema, calls Slack's conversations.invite API with channel and comma-separated users, and returns the channel info.
    export async function inviteToChannel(client: SlackClientWrapper, args: unknown) {
      const params = inviteToChannelSchema.parse(args);
    
      return await client.safeCall(async () => {
        const result = await client.getClient().conversations.invite({
          channel: params.channel,
          users: params.users.join(','),
        });
    
        return {
          ok: true,
          channel: result.channel,
        };
      });
    }
  • Zod schema defining input validation for invite_to_channel: requires channel ID and non-empty array of user IDs.
    export const inviteToChannelSchema = z.object({
      channel: channelIdSchema,
      users: z.array(userIdSchema).min(1),
    });
  • src/index.ts:151-171 (registration)
    Tool registration in the tools list for list_tools handler, including name, description, and MCP inputSchema.
    {
      name: 'invite_to_channel',
      description: 'Invite users to a channel',
      inputSchema: {
        type: 'object',
        properties: {
          channel: {
            type: 'string',
            description: 'Channel ID',
          },
          users: {
            type: 'array',
            items: {
              type: 'string',
            },
            description: 'Array of user IDs to invite',
          },
        },
        required: ['channel', 'users'],
      },
    },
  • src/index.ts:423-423 (registration)
    Maps 'invite_to_channel' tool name to the userTools.inviteToChannel handler in the call_tool dispatcher.
    invite_to_channel: (args) => userTools.inviteToChannel(slackClient, args),

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/Hais/slack-bot-mcp'

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