slack_get_users
Retrieve a list of all workspace users with their basic profile information for team management and communication purposes.
Instructions
Get a list of all users in the workspace with their basic profile information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cursor | No | Pagination cursor for next page of results | |
| limit | No | Maximum number of users to return (default 100, max 200) |
Implementation Reference
- index.ts:191-206 (handler)Core implementation of fetching Slack users via the users.list API endpoint, with pagination support using limit (max 200) and cursor.async getUsers(limit: number = 100, cursor?: string): Promise<any> { const params = new URLSearchParams({ limit: Math.min(limit, 200).toString(), team_id: process.env.SLACK_TEAM_ID!, }); if (cursor) { params.append("cursor", cursor); } const response = await fetch(`https://slack.com/api/users.list?${params}`, { headers: this.botHeaders, }); return response.json(); }
- index.ts:342-349 (schema)Input schema definition for the slack_get_users tool using Zod, including optional pagination parameters.{ title: "Get Slack Users", description: "Get a list of all users in the workspace with their basic profile information", inputSchema: { cursor: z.string().optional().describe("Pagination cursor for next page of results"), limit: z.number().optional().default(100).describe("Maximum number of users to return (default 100, max 200)"), }, },
- index.ts:340-356 (registration)MCP server registration of the slack_get_users tool, including schema, description, and handler that calls SlackClient.getUsers and returns JSON response.server.registerTool( "slack_get_users", { title: "Get Slack Users", description: "Get a list of all users in the workspace with their basic profile information", inputSchema: { cursor: z.string().optional().describe("Pagination cursor for next page of results"), limit: z.number().optional().default(100).describe("Maximum number of users to return (default 100, max 200)"), }, }, async ({ cursor, limit }) => { const response = await slackClient.getUsers(limit, cursor); return { content: [{ type: "text", text: JSON.stringify(response) }], }; } );