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
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes | Channel ID | |
| users | Yes | Array of user IDs to invite |
Implementation Reference
- src/tools/users.ts:38-52 (handler)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, }; }); }
- src/utils/validators.ts:41-44 (schema)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),