Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

search-users

Find GitHub users by search query with options to sort by followers, repositories, or join date, and paginate results for efficient user discovery.

Instructions

Search for users on GitHub

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
orderNo
pageNo
per_pageNo
qYes
sortNo

Implementation Reference

  • The core handler function that executes the search-users tool. It validates input using SearchUsersSchema, calls the GitHub search.users API via Octokit, formats the results, and handles errors with tryCatchAsync.
    export async function searchUsers(args: unknown): Promise<any> { const { q, sort, order, page, per_page } = SearchUsersSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().search.users({ q, sort: sort as any, order, page, per_page, }); return { total_count: data.total_count, incomplete_results: data.incomplete_results, items: data.items.map((user) => ({ login: user.login, id: user.id, avatar_url: user.avatar_url, html_url: user.html_url, type: user.type, site_admin: user.site_admin, score: user.score, })), }; }, 'Failed to search users'); }
  • Zod schema used for runtime input validation of the search-users tool parameters.
    export const SearchUsersSchema = z.object({ q: z.string().min(1, 'Search query is required'), sort: z.enum(['followers', 'repositories', 'joined']).optional(), order: z.enum(['asc', 'desc']).optional(), page: z.number().min(1).optional(), per_page: z.number().min(1).max(100).optional(), });
  • Tool registration in the MCP server's listTools handler, defining the tool's metadata and input schema for MCP clients.
    { name: 'search-users', description: 'Search for users on GitHub', inputSchema: { type: 'object', properties: { q: { type: 'string', }, order: { type: 'string', enum: ['asc', 'desc'], }, page: { type: 'number', minimum: 1, }, per_page: { type: 'number', minimum: 1, maximum: 100, }, sort: { type: 'string', enum: ['followers', 'repositories', 'joined'], }, }, required: ['q'], additionalProperties: false, }, },
  • Dispatch case in the callToolRequest handler that routes execution to the searchUsers function.
    case 'search-users': result = await searchUsers(parsedArgs); break;

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/piyushgIITian/github-enterprice-mcp'

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