search_users
Find Jira users by name or email to obtain their account IDs for assigning issues in Jira Cloud.
Instructions
Search for Jira users by name or email to get their account ID. Use this to find account IDs for assigning issues.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query - can be email, name, or partial match (e.g., "john.doe@company.com" or "John Doe") | |
| maxResults | No | Maximum number of results to return (default: 50) |
Implementation Reference
- src/handlers/user-handlers.ts:7-64 (handler)Main handler function implementing the search_users tool. Queries the Jira /user/search API, formats results as Markdown with user details (display name, email, account ID, active status, account type), and handles empty results and errors.async handleSearchUsers(args: any) { try { const { query, maxResults = 50 } = args; if (!query) { throw new Error('query is required'); } const params = { query, maxResults, }; const users = await this.apiClient.get('/user/search', params); if (!users || users.length === 0) { return { content: [ { type: 'text', text: `No users found matching "${query}"`, }, ], }; } let response = `# User Search Results\n\n**Query**: ${query}\n**Found**: ${users.length} user(s)\n\n`; users.forEach((user: any) => { response += `## ${user.displayName}\n`; response += `- **Email**: ${user.emailAddress || 'N/A'}\n`; response += `- **Account ID**: \`${user.accountId}\`\n`; response += `- **Active**: ${user.active ? 'Yes' : 'No'}\n`; response += `- **Account Type**: ${user.accountType || 'N/A'}\n\n`; }); response += `\n💡 Use the **Account ID** when assigning issues.`; return { content: [ { type: 'text', text: response, }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: JiraFormatters.formatError(error), }, ], isError: true, }; } }
- src/tools/definitions.ts:170-187 (schema)Input schema and metadata definition for the search_users tool, specifying required 'query' parameter and optional 'maxResults'.{ name: 'search_users', description: 'Search for Jira users by name or email to get their account ID. Use this to find account IDs for assigning issues.', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query - can be email, name, or partial match (e.g., "john.doe@company.com" or "John Doe")', }, maxResults: { type: 'number', description: 'Maximum number of results to return (default: 50)', }, }, required: ['query'], }, },
- src/index.ts:118-119 (registration)Registers the tool call dispatching in the MCP server switch statement, routing 'search_users' requests to UserHandlers.handleSearchUsers.case 'search_users': return this.userHandlers.handleSearchUsers(request.params.arguments);