# Get Coin Value — CoinGecko

> Get the current price of one or more cryptocurrencies in any supported currencies. See the documentation

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

## Description

Get the current price of one or more cryptocurrencies in any supported currencies. [See the documentation](https://docs.coingecko.com/v3.0.1/reference/simple-price)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `vsCurrencies` | `string[]` | Yes | List of target currencies to convert to (e.g. usd,eur,btc). Options are loaded from the connected account. |
| `ids` | `string[]` | No | List of coin IDs (e.g. bitcoin,ethereum) |
| `includeMarketCap` | `boolean` | No | Include market cap data in the response. |
| `include24hrVol` | `boolean` | No | Include 24-hour trading volume in the response. |
| `include24hrChange` | `boolean` | No | Include 24-hour price change percentage in the response. |
| `includeLastUpdatedAt` | `boolean` | No | Include the last updated UNIX timestamp in the response. |
| `precision` | `string` | No | Decimal precision for price values. Use full for full precision or a number from 0 to 18. |

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

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: "coingecko-get-coin-value",
  arguments: {
    vsCurrencies: ["Target Currencies"],
    ids: ["Coin IDs"],
  },
})
```

**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: "coingecko-get-coin-value",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    coingecko: { authProvisionId: "apn_xxxxxxx" },
    vsCurrencies: ["Target Currencies"],
    ids: ["Coin IDs"],
  },
})

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": "coingecko-get-coin-value",
    "configured_props": {
      "coingecko": { "authProvisionId": "apn_xxxxxxx" },
      "vsCurrencies": ["Target Currencies"],
      "ids": ["Coin IDs"]
    }
  }'
```

---

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