# List Folders — Box

> Lists the subfolders directly inside a Box folder. Use 0 for the root folder. Returns one page of results (default 100, max 1000). Use List Folder Items instead to also include files and web links. See the documentation.

- Key: `box-list-folders`
- Type: Action (Read-only)
- Version: 0.0.2
- App: Box (`box`) — https://pipedream.com/apps/box.md
- This page (HTML): https://pipedream.com/apps/box/actions/list-folders
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/box/actions/list-folders/list-folders.mjs

## Description

Lists the subfolders directly inside a Box folder. Use `0` for the root folder. Returns one page of results (default 100, max 1000). Use **List Folder Items** instead to also include files and web links. [See the documentation](https://developer.box.com/reference/get-folders-id-items/).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `folderId` | `string` | Yes | The folder to list subfolders from. Use 0 for the root folder. Options are loaded from the connected account. |
| `fields` | `string[]` | No | A comma-separated list of attributes to include in the response (e.g. id,type,name,size,created_at). See available fields. |
| `sort` | `string` | No | Defines the attribute by which items are sorted. Valid values: id, name, date, size (e.g. name). Not supported for the root folder (0) — Box does not allow sorting root-folder results with marker-based pagination. |
| `direction` | `string` | No | The direction to sort results in. Valid values: ASC (ascending) or DESC (descending) (e.g. ASC). |
| `limit` | `integer` | No | The maximum number of folders to return per page (max 1000) |
| `marker` | `string` | No | The position marker at which to begin returning results. Pass the next_marker value returned by a previous run of this action to continue listing beyond the first page, e.g. JV9IRGZmieiBasejOG9yDCRNgd2ymoZIbjsxbJMjIs3kioVii. |

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

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: "box-list-folders",
  arguments: {
    folderId: "Folder",
    fields: ["Fields"],
  },
})
```

**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: "box-list-folders",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    box: { authProvisionId: "apn_xxxxxxx" },
    folderId: "Folder",
    fields: ["Fields"],
  },
})

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": "box-list-folders",
    "configured_props": {
      "box": { "authProvisionId": "apn_xxxxxxx" },
      "folderId": "Folder",
      "fields": ["Fields"]
    }
  }'
```

---

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