SearchUsers creates a tool to search for GitHub users.
(t translations.TranslationHelperFunc)
| 410 | |
| 411 | // SearchUsers creates a tool to search for GitHub users. |
| 412 | func SearchUsers(t translations.TranslationHelperFunc) inventory.ServerTool { |
| 413 | schema := &jsonschema.Schema{ |
| 414 | Type: "object", |
| 415 | Properties: map[string]*jsonschema.Schema{ |
| 416 | "query": { |
| 417 | Type: "string", |
| 418 | Description: "User search query. Examples: 'john smith', 'location:seattle', 'followers:>100'. Search is automatically scoped to type:user.", |
| 419 | }, |
| 420 | "sort": { |
| 421 | Type: "string", |
| 422 | Description: "Sort users by number of followers or repositories, or when the person joined GitHub.", |
| 423 | Enum: []any{"followers", "repositories", "joined"}, |
| 424 | }, |
| 425 | "order": { |
| 426 | Type: "string", |
| 427 | Description: "Sort order", |
| 428 | Enum: []any{"asc", "desc"}, |
| 429 | }, |
| 430 | }, |
| 431 | Required: []string{"query"}, |
| 432 | } |
| 433 | WithPagination(schema) |
| 434 | |
| 435 | return NewTool( |
| 436 | ToolsetMetadataUsers, |
| 437 | mcp.Tool{ |
| 438 | Name: "search_users", |
| 439 | Description: t("TOOL_SEARCH_USERS_DESCRIPTION", "Find GitHub users by username, real name, or other profile information. Useful for locating developers, contributors, or team members."), |
| 440 | Annotations: &mcp.ToolAnnotations{ |
| 441 | Title: t("TOOL_SEARCH_USERS_USER_TITLE", "Search users"), |
| 442 | ReadOnlyHint: true, |
| 443 | }, |
| 444 | InputSchema: schema, |
| 445 | }, |
| 446 | []scopes.Scope{scopes.Repo}, |
| 447 | func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { |
| 448 | return userOrOrgHandler(ctx, "user", deps, args) |
| 449 | }, |
| 450 | ) |
| 451 | } |
| 452 | |
| 453 | // SearchOrgs creates a tool to search for GitHub organizations. |
| 454 | func SearchOrgs(t translations.TranslationHelperFunc) inventory.ServerTool { |