Skip to main content
Glama

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
NameRequiredDescriptionDefault
usernameYesGitHub username

Implementation Reference

  • 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;
      }
  • 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'],
      },
    },
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oghenetejiriorukpegmail/github-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server