Skip to main content
Glama

search_users

Search for GitHub users by location, language, follower count, and more using advanced query syntax. Sort results by followers, repositories, or join date.

Instructions

Search for GitHub users.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesSearch query using GitHub users search syntax. Examples: 'location:"San Francisco" followers:>100', 'language:python repos:>50', 'fullname:"John Doe"', 'type:user', 'type:org', 'created:>2020-01-01', 'in:email example.com'
sortNoSort field by category
orderNoSort order
per_pageNoResults per page (default 10, max 100)
pageNoPage number (default 1)

Implementation Reference

  • The handler function for the 'search_users' tool. Calls octokit.rest.search.users and formats results (login, name, bio, location, company, repos, followers). Registered via server.tool() as an MCP tool.
    // Tool: Search Users
    server.tool(
    	"search_users",
    	"Search for GitHub users.",
    	{
    		q: z
    			.string()
    			.describe(
    				"Search query using GitHub users search syntax. Examples: 'location:\"San Francisco\" followers:>100', 'language:python repos:>50', 'fullname:\"John Doe\"', 'type:user', 'type:org', 'created:>2020-01-01', 'in:email example.com'",
    			),
    		sort: z
    			.enum(["followers", "repositories", "joined"])
    			.optional()
    			.describe("Sort field by category"),
    		order: z.enum(["asc", "desc"]).optional().describe("Sort order"),
    		per_page: z
    			.number()
    			.optional()
    			.default(10)
    			.describe("Results per page (default 10, max 100)"),
    		page: z
    			.number()
    			.optional()
    			.default(1)
    			.describe("Page number (default 1)"),
    	},
    	async ({ q, sort, order, per_page, page }) => {
    		try {
    			const response = await octokit.rest.search.users({
    				q,
    				sort,
    				order,
    				per_page,
    				page,
    			})
    
    			// Extract only essential information
    			const users = response.data.items.map(user => ({
    				login: user.login,
    				type: user.type,
    				// Only include name if it exists and is different from login
    				...(user.name && user.name !== user.login ? { name: user.name } : {}),
    				// Include bio if it exists (truncated)
    				...(user.bio
    					? {
    							bio:
    								user.bio.slice(0, 100) + (user.bio.length > 100 ? "..." : ""),
    						}
    					: {}),
    				// Include location if it exists
    				...(user.location ? { location: user.location } : {}),
    				// Include company if it exists
    				...(user.company ? { company: user.company } : {}),
    				// Include public repos if > 0
    				...(user.public_repos && user.public_repos > 0
    					? { repos: user.public_repos }
    					: {}),
    				// Only include followers if > 0
    				...(user.followers && user.followers > 0
    					? { followers: user.followers }
    					: {}),
    			}))
    
    			// Format as simple text
    			const text = users
    				.map((user, i) => {
    					let line = `${i + 1}. **${user.login}**${user.name ? ` (${user.name})` : ""}${user.type === "Organization" ? " `[org]`" : ""}`
    					const details = []
    					if (user.followers)
    						details.push(`${user.followers.toLocaleString()} followers`)
    					if (user.repos) details.push(`${user.repos} repos`)
    					if (user.location) details.push(user.location)
    					if (user.company) details.push(user.company)
    					if (details.length > 0) line += `\n   ${details.join(" • ")}`
    					if (user.bio) line += `\n   > ${user.bio}`
    					return line
    				})
    				.join("\n\n")
    
    			return {
    				content: [
    					{
    						type: "text",
    						text: text
    							? `### Found ${users.length} users:\n\n${text}`
    							: "No users found",
    					},
    				],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • Zod schema for input validation of the search_users tool: query string (required), sort by followers/repositories/joined, order asc/desc, per_page (default 10), page (default 1).
    {
    	q: z
    		.string()
    		.describe(
    			"Search query using GitHub users search syntax. Examples: 'location:\"San Francisco\" followers:>100', 'language:python repos:>50', 'fullname:\"John Doe\"', 'type:user', 'type:org', 'created:>2020-01-01', 'in:email example.com'",
    		),
    	sort: z
    		.enum(["followers", "repositories", "joined"])
    		.optional()
    		.describe("Sort field by category"),
    	order: z.enum(["asc", "desc"]).optional().describe("Sort order"),
    	per_page: z
    		.number()
    		.optional()
    		.default(10)
    		.describe("Results per page (default 10, max 100)"),
    	page: z
    		.number()
    		.optional()
    		.default(1)
    		.describe("Page number (default 1)"),
    },
  • Registration of the 'search_users' tool via server.tool() within the registerSearchTools function in src/tools/search.ts.
    // Tool: Search Users
    server.tool(
    	"search_users",
    	"Search for GitHub users.",
  • src/index.ts:15-15 (registration)
    Call to registerSearchTools from the main index.ts entry point, which registers all search tools including search_users.
    registerSearchTools(server, octokit)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description must disclose behavioral traits. It only states 'Search for GitHub users' without mentioning any behavioral context such as pagination, authentication requirements, or what the response contains (e.g., user objects with specific fields).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at one sentence, containing no wasted words. However, it is too brief to be helpful; it sacrifices informativeness for brevity, making it less effective overall.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has a moderate complexity with multiple parameters and no output schema. The description fails to explain return values or provide sufficient context for an agent to understand the tool's complete behavior. It is inadequate given the tool's features.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the baseline is 3. The description does not add any extra meaning beyond what is already in the schema. It does not explain parameter usage or provide examples beyond the schema's own descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches for GitHub users, using a specific verb and resource. It distinguishes itself from sibling search tools like search_repositories and search_code by focusing on users. However, it lacks additional context about the search functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description does not mention prerequisites, limitations, or scenarios where another sibling tool would be more appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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