notion_list_all_users
Retrieve all users in a Notion workspace using an Organization API key. Supports pagination and returns data in JSON or markdown format for reading or modification purposes.
Instructions
List all users in the Notion workspace. Note: This function requires upgrading to the Notion Enterprise plan and using an Organization API key to avoid permission errors.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| start_cursor | No | Pagination start cursor for listing users | |
| page_size | No | Number of users to retrieve (max 100) | |
| format | No | Specify the response format. 'json' returns the original data structure, 'markdown' returns a more readable format. Use 'markdown' when the user only needs to read the page and isn't planning to write or modify it. Use 'json' when the user needs to read the page with the intention of writing to or modifying it. | markdown |
Implementation Reference
- src/client/index.ts:162-175 (handler)Actual implementation of the listAllUsers method that makes a GET request to the Notion API /users endpoint with optional pagination parameters (start_cursor and page_size)async listAllUsers( start_cursor?: string, page_size?: number ): Promise<ListResponse> { const params = new URLSearchParams(); if (start_cursor) params.append("start_cursor", start_cursor); if (page_size) params.append("page_size", page_size.toString()); const response = await fetch(`${this.baseUrl}/users?${params.toString()}`, { method: "GET", headers: this.headers, }); return response.json(); }
- src/types/schemas.ts:197-215 (schema)Tool schema definition that defines the name, description, and input schema for notion_list_all_users including start_cursor, page_size, and format parametersexport const listAllUsersTool: Tool = { name: "notion_list_all_users", description: "List all users in the Notion workspace. **Note:** This function requires upgrading to the Notion Enterprise plan and using an Organization API key to avoid permission errors.", inputSchema: { type: "object", properties: { start_cursor: { type: "string", description: "Pagination start cursor for listing users", }, page_size: { type: "number", description: "Number of users to retrieve (max 100)", }, format: formatParameter, }, }, };
- src/server/index.ts:153-161 (registration)Request handler case statement that processes the notion_list_all_users tool call, extracts arguments, and calls the client's listAllUsers methodcase "notion_list_all_users": { const args = request.params .arguments as unknown as args.ListAllUsersArgs; response = await notionClient.listAllUsers( args.start_cursor, args.page_size ); break; }
- src/server/index.ts:317-341 (registration)Tool registration in the ListToolsRequestSchema handler where listAllUsersTool is added to the allTools array that gets filtered and returned to clientsserver.setRequestHandler(ListToolsRequestSchema, async () => { const allTools = [ schemas.appendBlockChildrenTool, schemas.retrieveBlockTool, schemas.retrieveBlockChildrenTool, schemas.deleteBlockTool, schemas.updateBlockTool, schemas.createPageTool, schemas.retrievePageTool, schemas.updatePagePropertiesTool, schemas.listAllUsersTool, schemas.retrieveUserTool, schemas.retrieveBotUserTool, schemas.createDatabaseTool, schemas.queryDatabaseTool, schemas.retrieveDatabaseTool, schemas.updateDatabaseTool, schemas.createDatabaseItemTool, schemas.createCommentTool, schemas.retrieveCommentsTool, schemas.searchTool, ]; return { tools: filterTools(allTools, enabledToolsSet), };
- src/types/args.ts:58-62 (helper)TypeScript interface defining the arguments structure for ListAllUsers including optional start_cursor, page_size, and format parametersexport interface ListAllUsersArgs { start_cursor?: string; page_size?: number; format?: "json" | "markdown"; }