# Add Task To Section — Asana

> Add a task to a specific, existing section. This will remove the task from other sections of the project. See the documentation

- Key: `asana-add-task-to-section`
- Type: Action (Write)
- Version: 0.2.16
- App: Asana (`asana`) — https://pipedream.com/apps/asana.md
- This page (HTML): https://pipedream.com/apps/asana/actions/add-task-to-section
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/asana/actions/add-task-to-section/add-task-to-section.mjs

## Description

Add a task to a specific, existing section. This will remove the task from other sections of the project. [See the documentation](https://developers.asana.com/docs/add-task-to-section)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `workspace` | `string` | Yes | Gid of a workspace. Options are loaded from the connected account. |
| `project` | `string` | Yes | List of projects. This field uses the project GID. Options are loaded from the connected account. |
| `task` | `string` | Yes | The task to add to this section. Options are loaded from the connected account. |
| `section_gid` | `string` | Yes | The globally unique identifier for the section. Options are loaded from the connected account. |
| `insert_before` | `string` | No | An existing task within this section before which the added task should be inserted. Cannot be provided together with insert_after. Options are loaded from the connected account. |
| `insert_after` | `string` | No | An existing task within this section after which the added task should be inserted. Cannot be provided together with insert_before. Options are loaded from the connected account. |

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

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: "asana-add-task-to-section",
  arguments: {
    workspace: "Workspace",
    project: "Project",
  },
})
```

**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: "asana-add-task-to-section",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    asana: { authProvisionId: "apn_xxxxxxx" },
    workspace: "Workspace",
    project: "Project",
  },
})

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": "asana-add-task-to-section",
    "configured_props": {
      "asana": { "authProvisionId": "apn_xxxxxxx" },
      "workspace": "Workspace",
      "project": "Project"
    }
  }'
```

---

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