update-user
Modify user profile details on GitHub Enterprise, including email, name, company, location, bio, blog, and Twitter username, via the GitHub Enterprise MCP Server integration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bio | No | Biography for the user | |
| blog | No | URL of the user's blog or website | |
| company | No | Company for the user | |
| No | The email address for the user | ||
| location | No | Location for the user | |
| name | No | Full name for the user | |
| twitter_username | No | Twitter username for the user | |
| username | Yes | Username of the user to update |
Implementation Reference
- server/index.ts:1919-1977 (registration)MCP tool registration for 'update-user', including inline handler that delegates to UserManagement.updateUser and zod input schema validation.server.tool( "update-user", { username: z.string().describe("Username of the user to update"), email: z.string().optional().describe("The email address for the user"), name: z.string().optional().describe("Full name for the user"), company: z.string().optional().describe("Company for the user"), location: z.string().optional().describe("Location for the user"), bio: z.string().optional().describe("Biography for the user"), blog: z.string().optional().describe("URL of the user's blog or website"), twitter_username: z.string().optional().describe("Twitter username for the user") }, async ({ username, email, name, company, location, bio, blog, twitter_username }) => { try { if (!context.isGitHubEnterprise) { return { content: [ { type: "text", text: "User updates are only available in GitHub Enterprise. This operation cannot be performed on GitHub.com." } ], isError: true }; } const user = await context.users.updateUser(context.client, { username, email, name, company, location, bio, blog, twitter_username }); return { content: [ { type: "text", text: `User '${username}' successfully updated:\n\n${JSON.stringify(user, null, 2)}` } ] }; } catch (error: any) { console.error('Error updating user:', error); return { content: [ { type: "text", text: `An error occurred while updating user: ${error.message}` } ], isError: true }; } } );
- api/users/users.ts:178-207 (handler)Core handler function in UserManagement class that performs the actual GitHub API PATCH request to update user via /admin/users/{username} endpoint.async updateUser(client: any, params: UpdateUserParams): Promise<User> { try { const { baseUrl, token } = client; const { username, ...userData } = params; if (!username) { throw new Error('Username is required'); } const url = `${baseUrl}/admin/users/${username}`; const response = await axios.patch(url, userData, { headers: { Authorization: `token ${token}`, Accept: 'application/vnd.github.v3+json', 'Content-Type': 'application/json' } }); return response.data; } catch (error: any) { if (error.response?.status === 404) { throw new Error(`User '${params.username}' not found or admin endpoint not available`); } else if (error.response?.status === 422) { throw new Error(`Validation failed: ${error.response.data.message || 'Check the provided data format'}`); } throw new Error(`Failed to update user: ${error.message}`); } }
- api/users/types.ts:144-149 (schema)TypeScript interface defining input parameters for updating a user, extending CreateUserParams partially with required username.export interface UpdateUserParams extends Partial<CreateUserParams> { /** * Username of the user to update */ username: string; }