# Find Users — Jira Service Desk

> Finds any active user on an Atlassian site by name or email address and returns the accountId of each match. Pick this tool when the person does not have to be a customer of one particular service desk, i.e. to fill requestParticipants on…

- Key: `jira_service_desk-find-users`
- Type: Action (Read-only)
- Version: 0.0.1
- App: Jira Service Desk (`jira_service_desk`) — https://pipedream.com/apps/jira-service-desk.md
- This page (HTML): https://pipedream.com/apps/jira-service-desk/actions/find-users
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/jira_service_desk/actions/find-users/find-users.mjs

## Description

Finds any active user on an Atlassian site by name or email address and returns the `accountId` of each match. **Pick this tool when the person does not have to be a customer of one particular service desk**, i.e. to fill `requestParticipants` on **Create Request** with an approver, manager, watcher, or agent, or when the user names somebody but no service desk is known yet. Natural-language cues: "add my manager Dana as a participant", "cc the security lead on this ticket", "loop in john@acme.com", "what is the account ID for Jean?". Pick **Find Service Desk Customers** instead when you already know the service desk and the person is the one the ticket is being raised for (`raiseOnBehalfOf`). That tool is more precise, confirms the person can actually raise a request on that desk, and excludes bots. Use **List Sites** first to obtain the required `cloudId`. Worked example: for "open a laptop request and add Dana Lee as a participant", call this with Query `Dana Lee`, read `accountId` `5b10a2844c20165700ede21g` off the match whose `accountType` is `atlassian`, then pass `["5b10a2844c20165700ede21g"]` as `requestParticipants` on **Create Request**. Most users on a Jira site are bots, not people. Integrations come back as ordinary matches carrying `accountType` `app`, so read `accountType` and use only `atlassian` accounts as `raiseOnBehalfOf` or `requestParticipants`. Query is matched against `displayName` and `emailAddress`, and matches more than just the start of them. Pass a full name or a full email address to keep the result set tight. Results are paginated automatically up to `maxResults`. Returns `{ users, truncated }`. `truncated` is `true` when the result set may be incomplete, either because more matches remained unfetched or because collection stopped at Atlassian's 1000-match limit, which looks the same whether or not further matches exist. Once you have 1000 matches, narrow the query rather than raising `maxResults`, which cannot go higher. `accountId` is the only field guaranteed present: Atlassian's profile visibility rules hide `emailAddress` on users who have not made it public, so match on `displayName` and never require an email to be returned. An empty `users` list means either nobody matched or the connected account lacks the "Browse users and groups" global permission, which Atlassian reports as zero results rather than as an error. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-user-search/#api-rest-api-3-user-search-get)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `cloudId` | `string` | Yes | The Atlassian site (cloud) ID, e.g. 822faf0d-5427-420e-9016-999d3dc76918. Run List Sites to get the id of every site you can access. |
| `query` | `string` | Yes | Name or email address to search for, e.g. Joseph Wilson or joseph@example.com. Matched against displayName and emailAddress. A full name or full email address gives the tightest result set. |
| `maxResults` | `integer` | No | Maximum number of users to return across all pages (1-1000). |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "jira_service_desk",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "jira_service_desk-find-users",
  arguments: {
    cloudId: "Cloud ID",
    query: "Query",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "jira_service_desk-find-users",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    jira_service_desk: { authProvisionId: "apn_xxxxxxx" },
    cloudId: "Cloud ID",
    query: "Query",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "jira_service_desk-find-users",
    "configured_props": {
      "jira_service_desk": { "authProvisionId": "apn_xxxxxxx" },
      "cloudId": "Cloud ID",
      "query": "Query"
    }
  }'
```

---

- App: https://pipedream.com/apps/jira-service-desk.md · All apps: https://pipedream.com/apps
