# Search Documents — Linear (API key)

> Search Linear documents by text query, or list them filtered by project, initiative, or team. When query is provided, performs relevance-ranked full-text search across document titles and content (up to 200 results). When query is omitted…

- Key: `linear_app-search-documents`
- Type: Action (Read-only)
- Version: 0.0.3
- App: Linear (API key) (`linear_app`) — https://pipedream.com/apps/linear-app.md
- This page (HTML): https://pipedream.com/apps/linear-app/actions/search-documents
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/linear_app/actions/search-documents/search-documents.mjs

## Description

Search Linear documents by text query, or list them filtered by project, initiative, or team. When `query` is provided, performs relevance-ranked full-text search across document titles and content (up to 200 results). When `query` is omitted, lists documents matching the project/initiative/team filter (up to 20 by default). Results do NOT include the document `content` field — call **Get Document** with the returned `id` or `slugId` to fetch the full markdown body. Use **List Projects** for project IDs, **List Initiatives** for initiative IDs, and **Get Teams** for team IDs. Leave filter props out of the call entirely to search all accessible documents — do not pass `"*"` or empty strings. The optional `fields` prop narrows results to only the keys you need; defaults to a compact set of 8 fields (id, title, slugId, url, createdAt, updatedAt, project, documentContentId). Example: `query: "quarterly review"` → returns `[{id: "...", title: "Q3 Review Notes", url: "...", project: {id: "...", name: "Product"}, documentContentId: "..."}]`. Example (filter): `projectId: "b75b71a2-..."` → returns all documents attached to that project. [See the documentation](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/objects/Query?query=searchDocuments).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `query` | `string` | No | Free-text search term for relevance-ranked document search. When provided, searches across document titles and content. When omitted, lists documents by project/initiative/team filter instead. e.g. quarterly review |
| `projectId` | `string` | No | Filter documents by project UUID (e.g. a1b2c3d4-0000-0000-0000-000000000001). Applied only on the filter path (when no query is provided). Leave out entirely to search across all projects — do not pass "*" or an empty string. Use List Projects to find valid project IDs. |
| `initiativeId` | `string` | No | Filter documents by initiative UUID. Applied only on the filter path (when no query is provided). Use List Initiatives to find valid initiative IDs. e.g. 5f3c9a10-7b2d-4e61-9c84-2a1d6e0b7f43 |
| `teamId` | `string` | No | Filter documents by team UUID. Applied on both the search path (with query) and the filter path. Leave out entirely to search across all teams — do not pass "*" or an empty string. Use Get Teams to find valid team IDs. e.g. 9b2e4f70-1c3a-4d85-a6b9-0e7f2d4c8a15 |
| `includeArchived` | `boolean` | No | Should archived resources be included? (default: false) |
| `orderBy` | `string` | No | Sort order for results when using the filter path (no query). Available options: createdAt (default) and updatedAt. |
| `limit` | `integer` | No | Maximum total number of documents to return. Defaults to 200 when a query is provided, 20 when only filters are used. e.g. 50 |
| `fields` | `string[]` | No | Field names to return for each document. Defaults to a compact set: id, title, slugId, url, createdAt, updatedAt, project, documentContentId. Results never include content — use Get Document with the id or slugId to fetch the full markdown body. e.g. ["id", "title", "url"] |

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

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: "linear_app-search-documents",
  arguments: {
    query: "Query",
    projectId: "Project",
  },
})
```

**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: "linear_app-search-documents",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    linear_app: { authProvisionId: "apn_xxxxxxx" },
    query: "Query",
    projectId: "Project",
  },
})

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": "linear_app-search-documents",
    "configured_props": {
      "linear_app": { "authProvisionId": "apn_xxxxxxx" },
      "query": "Query",
      "projectId": "Project"
    }
  }'
```

---

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