get_user
Retrieve GitHub user information by providing a username to access profile details through the GitHub MCP Server.
Instructions
Get GitHub user information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| username | Yes | GitHub username |
Implementation Reference
- src/index.ts:166-198 (handler)Handler logic for the 'get_user' tool: validates username parameter, fetches user data from GitHub API endpoint `/users/{username}`, returns JSON response or error message.if (request.params.name === 'get_user') { const username = args.username; if (!username) { throw new McpError(ErrorCode.InvalidParams, 'Username is required'); } try { const response = await this.axiosInstance.get(`/users/${username}`); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { return { content: [ { type: 'text', text: `GitHub API error: ${ error.response?.data.message ?? error.message }`, }, ], isError: true, }; } throw error; }
- src/index.ts:99-108 (schema)Input schema definition for the 'get_user' tool, specifying required 'username' string parameter.inputSchema: { type: 'object', properties: { username: { type: 'string', description: 'GitHub username', }, }, required: ['username'], },
- src/index.ts:96-109 (registration)Registration of the 'get_user' tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'get_user', description: 'Get GitHub user information', inputSchema: { type: 'object', properties: { username: { type: 'string', description: 'GitHub username', }, }, required: ['username'], }, },