# Query IDs — Pinecone

> Searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. See the documentation.

- Key: `pinecone-query-ids`
- Type: Action (Write)
- Version: 0.0.4
- App: Pinecone (`pinecone`) — https://pipedream.com/apps/pinecone.md
- This page (HTML): https://pipedream.com/apps/pinecone/actions/query-ids
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pinecone/actions/query-ids/query-ids.mjs

## Description

Searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. [See the documentation](https://docs.pinecone.io/reference/api/data-plane/query).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `indexName` | `string` | Yes | The name of the index. E.g. my-index.pinecone.io Options are loaded from the connected account. |
| `topK` | `integer` | Yes | The number of results to return. E.g. 10 |
| `filter` | `object` | No | The filter to apply. You can use vector metadata to limit your search. For guidance and examples, see filtering-with-metadata. |
| `includeValues` | `boolean` | No | Whether to include the vector values in the response. |
| `includeMetadata` | `boolean` | No | Whether to include the vector metadata in the response. |
| `namespace` | `string` | No | The namespace to use. |
| `id` | `string` | No | The ID of the vector. Each request can contain only one of the parameters either Vector ID or Vector Values. |
| `vector` | `string[]` | No | The values of the vector. Each request can contain only one of the parameters either Vector Values or Vector ID. |

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

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: "pinecone-query-ids",
  arguments: {
    indexName: "Index Name",
    topK: 10,
  },
})
```

**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: "pinecone-query-ids",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pinecone: { authProvisionId: "apn_xxxxxxx" },
    indexName: "Index Name",
    topK: 10,
  },
})

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": "pinecone-query-ids",
    "configured_props": {
      "pinecone": { "authProvisionId": "apn_xxxxxxx" },
      "indexName": "Index Name",
      "topK": 10
    }
  }'
```

---

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