get-user
Retrieve user details by ID or email address from the n8n MCP Server to integrate user data securely into workflows and LLM interactions.
Instructions
Get user by ID or email address.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| idOrEmail | Yes |
Implementation Reference
- src/index.ts:1329-1360 (handler)MCP server handler for the 'get-user' tool. Validates client, calls N8nClient.getUser, and returns the user data as JSON or error.case "get-user": { const { clientId, idOrEmail } = args as { clientId: string; idOrEmail: string }; const client = clients.get(clientId); if (!client) { return { content: [{ type: "text", text: "Client not initialized. Please run init-n8n first.", }], isError: true }; } try { const user = await client.getUser(idOrEmail); return { content: [{ type: "text", text: JSON.stringify(user, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:592-602 (registration)Registration of the 'get-user' tool in the ListTools response, including name, description, and input schema.name: "get-user", description: "Get user by ID or email address.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, idOrEmail: { type: "string" } }, required: ["clientId", "idOrEmail"] } },
- src/index.ts:241-243 (helper)Core implementation in N8nClient class: makes HTTP request to n8n API endpoint /users/{idOrEmail} to fetch user data.async getUser(idOrEmail: string): Promise<N8nUser> { return this.makeRequest<N8nUser>(`/users/${idOrEmail}`); }
- src/index.ts:8-17 (schema)TypeScript interface defining the structure of a N8n user object returned by the API.interface N8nUser { id: string; email: string; firstName?: string; lastName?: string; isPending: boolean; role?: string; createdAt: string; updatedAt: string; }