get_users
Find Jira users by name or email. Optionally filter by project access and set maximum results.
Instructions
Search for users in Jira
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_users"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Search query for user name or email | |
| projectKey | No | Filter users by project access | |
| maxResults | No | Maximum number of users to return (1-100) |
Implementation Reference
- src/tools/assignments.ts:62-131 (handler)The handleAssignmentTool function contains the 'get_users' case (lines 81-102) that validates args using getUsersSchema, calls jiraClient.getUsers(), maps results to essential fields, and returns JSON-stringified user data.
export async function handleAssignmentTool( name: string, args: Record<string, unknown>, jiraClient: JiraClient ) { switch (name) { case 'assign_issue': { const validatedArgs = await assignIssueSchema.validate(args); const _result = await jiraClient.assignIssue(validatedArgs); return { content: [ { type: 'text', text: `Issue ${validatedArgs.issueKey} assigned successfully`, }, ], }; } case 'get_users': { const validatedArgs = await getUsersSchema.validate(args); const users = await jiraClient.getUsers(validatedArgs); // Extract essential fields, improve syntax const essentialUsers = users.map((user) => ({ id: user.accountId, // Shorter field name name: user.displayName, // Shorter field name email: user.emailAddress, // Shorter field name active: user.active, type: user.accountType // Shorter field name })); return { content: [ { type: 'text', text: JSON.stringify(essentialUsers, null, 2), }, ], }; } case 'get_current_user': { const user = await jiraClient.getCurrentUser(); // Extract essential fields, improve syntax const userData = user; const essentialUser = { id: userData.accountId, // Shorter field name name: userData.displayName, // Shorter field name email: userData.emailAddress, // Shorter field name active: userData.active, timezone: userData.timeZone, // Shorter field name type: userData.accountType // Shorter field name }; return { content: [ { type: 'text', text: JSON.stringify(essentialUser, null, 2), }, ], }; } default: throw new Error(`Unknown assignment tool: ${name}`); } } - src/tools/assignments.ts:29-60 (registration)The tool 'get_users' is registered as an MCP tool with name 'get_users', description 'Search for users in Jira', and inputSchema defining query, projectKey, and maxResults parameters.
{ name: 'get_users', description: 'Search for users in Jira', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for user name or email', }, projectKey: { type: 'string', description: 'Filter users by project access', }, maxResults: { type: 'number', description: 'Maximum number of users to return (1-100)', default: 50, }, }, }, }, { name: 'get_current_user', description: 'Get information about the current authenticated user', inputSchema: { type: 'object', properties: {}, }, }, ]; } - src/schemas/index.ts:126-130 (schema)The getUsersSchema Yup validation schema defines optional 'query' (string), optional 'projectKey' (string), and 'maxResults' (number, min 1, max 100, default 50).
export const getUsersSchema = yup.object({ query: yup.string().optional(), projectKey: yup.string().optional(), maxResults: yup.number().min(1).max(100).default(50), }); - src/schemas/index.ts:251-251 (schema)The GetUsersInput TypeScript type is inferred from the getUsersSchema.
export type GetUsersInput = yup.InferType<typeof getUsersSchema>;