# Find or Create Task — Dart

> Checks for an existing task within a dartboard using the 'task-name'. If it doesn't exist, a new task is created. See the documentation

- Key: `dart-find-or-create-task`
- Type: Action (Read-only)
- Version: 1.0.0
- App: Dart (`dart`) — https://pipedream.com/apps/dart.md
- This page (HTML): https://pipedream.com/apps/dart/actions/find-or-create-task
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/dart/actions/find-or-create-task/find-or-create-task.mjs

## Description

Checks for an existing task within a dartboard using the 'task-name'. If it doesn't exist, a new task is created. [See the documentation](https://app.dartai.com/api/v0/public/docs/#/Task/createTask)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `dartboard` | `string` | Yes | The dartboard where the task is or will be located Options are loaded from the connected account. |
| `title` | `string` | Yes | The name of the task |
| `parentId` | `string` | No | The universal, unique ID of the parent task. These tasks have a parent-child relationship where the current task is the child and this task ID corresponds to the parent. Subtasks inherit context from their parent and are typically smaller units of work Options are loaded from the connected account. |
| `type` | `string` | No | The title of the type of the task Options are loaded from the connected account. |
| `status` | `string` | No | The status from the list of available statuses Options are loaded from the connected account. |
| `description` | `string` | Yes | A longer description of the task, which can include markdown formatting |
| `assignees` | `string[]` | No | The names or emails of the users that the task is assigned to. Either this or assignee must be included, depending on whether the workspaces allows multiple assignees or not Options are loaded from the connected account. |
| `assignee` | `string` | No | The name or email of the user that the task is assigned to. Either this or assignees must be included, depending on whether the workspaces allows multiple assignees or not Options are loaded from the connected account. |
| `tags` | `string[]` | No | Any tags that should be applied to the task, which can be used to filter and search for tasks. Tags are also known as labels or components and are strings that can be anything, but should be short and descriptive Options are loaded from the connected account. |
| `priority` | `string` | No | The priority, which is a string that can be one of the specified options. This is used to sort tasks and determine which tasks should be done first Options are loaded from the connected account. |
| `startAt` | `string` | No | The start date, which is a date that the task should be started by in ISO format, like YYYY-MM-DD |
| `dueAt` | `string` | No | The due date for the task in ISO format, like YYYY-MM-DD |
| `size` | `string` | No | The size of the task Options are loaded from the connected account. |
| `customProperties` | `object` | No | The custom properties, which is an object of custom properties that are associated with the task |

## 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": "dart",
      },
    },
  },
)

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: "dart-find-or-create-task",
  arguments: {
    dartboard: "Dartboard",
    title: "Task Name",
  },
})
```

**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: "dart-find-or-create-task",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    dart: { authProvisionId: "apn_xxxxxxx" },
    dartboard: "Dartboard",
    title: "Task Name",
  },
})

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": "dart-find-or-create-task",
    "configured_props": {
      "dart": { "authProvisionId": "apn_xxxxxxx" },
      "dartboard": "Dartboard",
      "title": "Task Name"
    }
  }'
```

---

- App: https://pipedream.com/apps/dart.md · All apps: https://pipedream.com/apps
