Skip to content

feat(jira): add search_users tool for user lookup by email - #3451

Merged
waleedlatif1 merged 7 commits into
stagingfrom
waleedlatif1/jira-user-search-tool
Mar 7, 2026
Merged

feat(jira): add search_users tool for user lookup by email#3451
waleedlatif1 merged 7 commits into
stagingfrom
waleedlatif1/jira-user-search-tool

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add jira_search_users tool to look up Jira users by email or display name via GET /rest/api/3/user/search
  • Wire up "Search Users" operation in the Jira block with query, maxResults, and startAt fields
  • Register tool in registry, barrel exports, and auto-generated docs

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@cursor

cursorBot commented Mar 7, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Adds a new Jira API integration that searches and returns user records (including email addresses), introducing new external requests and potential PII exposure plus pagination edge cases.

Overview
Adds a new Jira tool, jira_search_users, that calls GET /rest/api/3/user/search (resolving cloudId when needed) and returns a paginated list of matching users.

Wires a new Search Users operation into the Jira block UI/param mapping, exports/registers the tool in the Jira barrel and global tools/registry, and documents the new tool in apps/docs.

Written by Cursor Bugbot for commit 1bbeee4. Configure here.

@vercel

vercelBot commented Mar 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedMar 7, 2026 1:56am

Request Review

Comment threadapps/sim/tools/jira/search_users.ts Outdated
@greptile-apps

greptile-appsBot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a jira_search_users tool that enables searching for Jira users by email address or display name via GET /rest/api/3/user/search. The implementation follows established patterns from the existing jira_get_users tool — including the dual-path cloudId/domain resolution strategy, shared utilities (transformUser, getJiraCloudId, USER_OUTPUT_PROPERTIES), block config conventions, and registry/barrel wiring. The feature is functionally complete and the types, docs, and block inputs are all consistent.

Key points:

  • New tool jira_search_users added in search_users.ts with correct OAuth, params, request, transformResponse, and outputs schema.
  • Block integration in jira.ts adds the "Search Users" operation with searchUsersQuery (required, basic mode), and searchUsersMaxResults/searchUsersStartAt (advanced mode), properly parsed to numbers before being forwarded to the tool.
  • Types in types.ts are accurate and JiraSearchUsersResponse is added to the JiraResponse union.
  • Double-fetch pattern: when cloudId is absent, the framework's initial fetch to accessible-resources is silently discarded and getJiraCloudId issues a second, identical request. This is a pre-existing pattern from get_users.ts and is replicated here — but worth addressing in both tools for efficiency.
  • filter(Boolean) before map ensures transformUser is never called with a falsy value, which prevents potential null-handling issues at runtime.

Confidence Score: 4/5

  • This PR is safe to merge — it adds a well-scoped new feature that follows existing patterns with no breaking changes.
  • The implementation is consistent with the existing Jira tool family, types are accurate, and edge cases are handled defensively. The one notable issue is the inherited double-fetch to accessible-resources, which is a minor inefficiency rather than a correctness bug. No tests were added, as acknowledged in the checklist.
  • apps/sim/tools/jira/search_users.ts — specifically the accessible-resources double-fetch on lines 110–112, inherited from get_users.ts.

Important Files Changed

FilenameOverview
apps/sim/tools/jira/search_users.tsNew tool implementing Jira user search via GET /rest/api/3/user/search. Follows existing dual-fetch pattern (accessible-resources when cloudId is absent). The double-fetch to accessible-resources is inefficient but pre-existing. filter(Boolean) before map ensures null-return from transformUser is safely handled. Response body from framework's initial request is discarded in the no-cloudId path, consistent with get_users.ts.
apps/sim/blocks/blocks/jira.tsAdds "Search Users" operation with searchUsersQuery (required, basic mode), searchUsersMaxResults, and searchUsersStartAt (both advanced-mode). Tool mapping, params builder, and input schema all wired correctly and consistently with other operations.
apps/sim/tools/jira/types.tsAdds JiraSearchUsersParams and JiraSearchUsersResponse interfaces, and appends JiraSearchUsersResponse to the JiraResponse union type. Type definitions are accurate and consistent with the implementation.
apps/sim/tools/jira/index.tsBarrel export updated to include jiraSearchUsersTool. No issues.
apps/sim/tools/registry.tsjira_search_users tool registered in the tool registry. Placed correctly alongside other Jira tools. No issues.
apps/docs/content/docs/en/tools/jira.mdxDocumentation added for jira_search_users tool with accurate input/output tables matching the implementation. Note in total field clarifies the page-count vs total-match distinction.

Sequence Diagram

sequenceDiagram
participant UI as Jira Block UI
participant FW as Tool Framework
participant ST as search_users.ts
participant AO as Atlassian OAuth API
participant AJ as Atlassian Jira API
UI->>FW: Operation = "search_users" (query, maxResults, startAt)
FW->>FW: Build params via tool() config handler
alt cloudId provided
FW->>AJ: GET /ex/jira/{cloudId}/rest/api/3/user/search?query=...
AJ-->>FW: HTTP Response (array of users)
FW->>ST: transformResponse(response, params)
ST->>ST: response.ok check
ST->>ST: data = response.json()
else cloudId not provided
FW->>AO: GET /oauth/token/accessible-resources
AO-->>FW: HTTP Response (resources list)
FW->>ST: transformResponse(response, params)
ST->>AO: GET /oauth/token/accessible-resources (via getJiraCloudId)
AO-->>ST: resources list
ST->>ST: Find cloudId by domain
ST->>AJ: GET /ex/jira/{cloudId}/rest/api/3/user/search?query=...
AJ-->>ST: array of users
end
ST->>ST: filter(Boolean), map with transformUser
ST-->>FW: { success, output: { ts, users[], total, startAt, maxResults } }
FW-->>UI: Result
Loading

Last reviewed commit: 1bbeee4

Comment threadapps/sim/tools/jira/search_users.ts Outdated
Comment threadapps/sim/tools/jira/search_users.ts Outdated
Comment threadapps/sim/tools/jira/search_users.ts
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

Comment threadapps/sim/tools/jira/search_users.ts
Comment threadapps/sim/tools/jira/search_users.ts
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

Comment threadapps/sim/tools/jira/search_users.ts
Comment threadapps/sim/tools/jira/search_users.ts
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Comment threadapps/sim/tools/jira/search_users.ts
@waleedlatif1
waleedlatif1 merged commit 0a52b09 into stagingMar 7, 2026
12 checks passed
@waleedlatif1
waleedlatif1 deleted the waleedlatif1/jira-user-search-tool branch March 7, 2026 07:16
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@waleedlatif1