get-user
Retrieve user details from GitHub Enterprise by providing the username, enabling integration with GitHub API features via the MCP server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | Username of the user to retrieve |
Implementation Reference
- server/index.ts:1827-1857 (registration)MCP tool registration for 'get-user', including inline Zod input schema and the handler function that retrieves user details using the UserManagement helper and formats the response.server.tool( "get-user", { username: z.string().describe("Username of the user to retrieve") }, async ({ username }) => { try { const user = await context.users.getUser(context.client, { username }); return { content: [ { type: "text", text: `User details for '${username}':\n\n${JSON.stringify(user, null, 2)}` } ] }; } catch (error: any) { console.error('Error getting user details:', error); return { content: [ { type: "text", text: `An error occurred while retrieving user details: ${error.message}` } ], isError: true }; } } );
- api/users/users.ts:105-131 (handler)Core helper function getUser in UserManagement class that performs the actual GitHub API call to retrieve user information from /users/{username} endpoint.async getUser(client: any, params: GetUserParams): Promise<User> { try { const { baseUrl, token } = client; const { username } = params; if (!username) { throw new Error('Username is required'); } const url = `${baseUrl}/users/${username}`; const response = await axios.get(url, { headers: { Authorization: `token ${token}`, Accept: 'application/vnd.github.v3+json' } }); return response.data; } catch (error: any) { if (error.response?.status === 404) { throw new Error(`User '${params.username}' not found`); } throw new Error(`Failed to get user: ${error.message}`); } }
- api/users/types.ts:89-94 (schema)TypeScript interface GetUserParams defining the input parameters (username) for the getUser helper function.export interface GetUserParams { /** * Username of the user to retrieve */ username: string; }
- api/users/types.ts:10-56 (schema)TypeScript interface User defining the output type returned by getUser, including user details like login, id, name, email, etc.export interface User { login: string; id: number; node_id: string; avatar_url: string; gravatar_id: string; url: string; html_url: string; followers_url: string; following_url: string; gists_url: string; starred_url: string; subscriptions_url: string; organizations_url: string; repos_url: string; events_url: string; received_events_url: string; type: string; site_admin: boolean; name?: string; company?: string; blog?: string; location?: string; email?: string; hireable?: boolean; bio?: string; twitter_username?: string; public_repos?: number; public_gists?: number; followers?: number; following?: number; created_at?: string; updated_at?: string; suspended?: boolean; private_gists?: number; total_private_repos?: number; owned_private_repos?: number; disk_usage?: number; collaborators?: number; two_factor_authentication?: boolean; plan?: { name: string; space: number; private_repos: number; collaborators: number; }; }