get-user
Retrieve user details from Notion workspaces by providing a user ID to access profile information and permissions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_id | Yes | The ID of the user to retrieve |
Implementation Reference
- src/lib/mcp-server.ts:597-628 (registration)Registration of the 'get-user' MCP tool, including inline Zod input schema and the handler function that delegates to NotionService.retrieveUser(user_id) and formats the JSON response or error.this.server.tool( "get-user", { user_id: z.string().describe("The ID of the user to retrieve"), }, async ({ user_id }) => { try { const result = await this.notionService.retrieveUser(user_id); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { console.error("Error in get-user tool:", error); return { content: [ { type: "text", text: `Error: Failed to retrieve Notion user - ${ (error as Error).message }`, }, ], isError: true, }; } } );
- src/lib/notion.ts:292-300 (helper)The NotionService.retrieveUser method, which implements the core logic by calling the Notion SDK's client.users.retrieve with the provided user_id.async retrieveUser(userId: string) { try { return await this.client.users.retrieve({ user_id: userId, }); } catch (error) { this.handleError(error); } }