# Execute Task — Airplane

> Execute a task with a set of parameter values and receive a run ID to track the task's execution. See the documentation

- Key: `airplane-execute-task`
- Type: Action (Write)
- Version: 0.0.3
- App: Airplane (`airplane`) — https://pipedream.com/apps/airplane.md
- This page (HTML): https://pipedream.com/apps/airplane/actions/execute-task
- Hints: destructive · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/airplane/actions/execute-task/execute-task.mjs

## Description

Execute a task with a set of parameter values and receive a run ID to track the task's execution. [See the documentation](https://docs.airplane.dev/reference/api#tasks-execute)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | No | Unique ID of the task. You can find your task's ID by visiting the task's page on Airplane. The task ID is located at the end of the url. e.g. the task ID for https://app.airplane.dev/tasks/tsk20210728zxb2vxn is tsk20210728zxb2vxn Either an ID or a slug must be provided. |
| `slug` | `string` | No | Unique slug of the task. You can find your task's slug next to the task's name within the task editor on Airplane or by running airplane tasks list from the CLI. Either an ID or a slug must be provided. |
| `paramValues` | `object` | No | Mapping of parameter slug to value. You can find your task's parameter slugs inside the task editor on Airplane or by running airplane tasks list from the CLI. |

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

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: "airplane-execute-task",
  arguments: {
    id: "Task ID",
    slug: "Slug",
  },
})
```

**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: "airplane-execute-task",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    airplane: { authProvisionId: "apn_xxxxxxx" },
    id: "Task ID",
    slug: "Slug",
  },
})

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": "airplane-execute-task",
    "configured_props": {
      "airplane": { "authProvisionId": "apn_xxxxxxx" },
      "id": "Task ID",
      "slug": "Slug"
    }
  }'
```

---

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