slack_get_users
Retrieve a list of all workspace users with basic details, supporting pagination for large teams. Use this tool to access user information from Slack workspaces through the MCP server.
Instructions
Get a list of all users in the workspace with basic 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
- src/index.ts:54-60 (handler)Executes the slack_get_users tool by parsing arguments, calling slackClient.getUsers, and returning the JSON response.case "slack_get_users": { const args = request.params.arguments as unknown as GetUsersArgs; const response = await slackClient.getUsers(args.limit, args.cursor); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- src/slack/users.ts:3-26 (schema)Defines the TypeScript interface for arguments and the Tool object with name, description, and inputSchema for slack_get_users.export interface GetUsersArgs { cursor?: string; limit?: number; } export const getUsersTool: Tool = { name: "slack_get_users", description: "Get a list of all users in the workspace with basic information", inputSchema: { type: "object", properties: { cursor: { type: "string", description: "Pagination cursor for next page of results", }, limit: { type: "number", description: "Maximum number of users to return (default 100, max 200)", default: 100, }, }, }, };
- src/index.ts:25-29 (registration)Registers the slack_get_users tool by including getUsersTool in the list returned by ListToolsRequest handler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [getUsersTool, postMessageTool], }; });
- src/slack/client.ts:47-62 (helper)Implements the Slack API call to users.list endpoint with pagination parameters, used by the tool handler.async getUsers(limit: number = 100, cursor?: string): Promise<any> { const params = new URLSearchParams({ limit: Math.min(limit, 200).toString(), team_id: SlackClient.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(); }