# Get Recommendations — Spotify

> Create a list of recommendations based on the available information for a given seed entity and matched against similar artists and tracks. If there is sufficient information about the provided seeds, a list of tracks will be returned…

- Key: `spotify-get-recommendations`
- Type: Action (Write)
- Version: 0.1.8
- App: Spotify (`spotify`) — https://pipedream.com/apps/spotify.md
- This page (HTML): https://pipedream.com/apps/spotify/actions/get-recommendations
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/spotify/actions/get-recommendations/get-recommendations.mjs

## Description

Create a list of recommendations based on the available information for a given seed entity and matched against similar artists and tracks. If there is sufficient information about the provided seeds, a list of tracks will be returned together with pool size details. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-recommendations).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `seedArtists` | `string[]` | No | An array of Spotify IDs for seed artists. Type to search for any artist on Spotify. Up to 5 seed values may be provided in any combination of seedArtists, seedTracks and seedGenres. Options are loaded from the connected account. |
| `seedGenres` | `string[]` | No | An array of genres. Up to 5 seed values may be provided in any combination of seedArtists, seedTracks and seedGenres. Options are loaded from the connected account. |
| `seedTracks` | `string[]` | No | An array of Spotify IDs for a seed track. Type to search for any track on Spotify. Up to 5 seed values may be provided in any combination of seedArtists, seedTracks and seedGenres. Options are loaded from the connected account. |
| `limit` | `integer` | No | The maximum number of items to return. The default is 100. |

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

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: "spotify-get-recommendations",
  arguments: {
    seedArtists: ["Seed Artists"],
    seedGenres: ["Seed Genres"],
  },
})
```

**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: "spotify-get-recommendations",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    spotify: { authProvisionId: "apn_xxxxxxx" },
    seedArtists: ["Seed Artists"],
    seedGenres: ["Seed Genres"],
  },
})

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": "spotify-get-recommendations",
    "configured_props": {
      "spotify": { "authProvisionId": "apn_xxxxxxx" },
      "seedArtists": ["Seed Artists"],
      "seedGenres": ["Seed Genres"]
    }
  }'
```

---

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