> ## Documentation Index
> Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Search knowledge files

> Search knowledge files.

`knowledgeSearch(projectReference: ID!, input: KnowledgeSearchInput!): KnowledgeSearchResult!`

## Arguments

| Argument | Type | Required | Description |
| - | - | - | - |
| `projectReference` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | Yes | Project whose knowledge is selected. Ordinary callers require project.knowledge.read. A run-bound MCP service credential instead must match the persisted run's project and agent plus its actor or runtime transport binding; its effective sealed authority must grant the invoked tool and a knowledge selector. On project-scoped MCP endpoints, the scoped project supplies this value when omitted. |
| `input` | [`KnowledgeSearchInput!`](https://veryfront.com/docs/cloud/graphql/types/knowledgesearchinput) | Yes | |

## Input fields

### input

[`KnowledgeSearchInput`](https://veryfront.com/docs/cloud/graphql/types/knowledgesearchinput)

| Field | Type | Required | Description |
| - | - | - | - |
| `query` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | Text to match against knowledge file paths and frontmatter, 1 to 500 characters. Required on the first page. |
| `cursor` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | The previous page's pageInfo.endCursor. |
| `lookupTarget` | [`KnowledgeLookupTargetInput`](https://veryfront.com/docs/cloud/graphql/types/knowledgelookuptargetinput) | No | Source to search; omit for the main preview branch. |
| `limit` | [`Int`](https://veryfront.com/docs/cloud/graphql/types/int) | No | Files per page, 1 to 12; default 6. |
| `shardCount` | [`Int`](https://veryfront.com/docs/cloud/graphql/types/int) | No | Number of shards, 1 to 8; default 1. |
| `shardIndex` | [`Int`](https://veryfront.com/docs/cloud/graphql/types/int) | No | Shard to read, 0 to shardCount - 1. |

## Response

Returns [`KnowledgeSearchResult!`](https://veryfront.com/docs/cloud/graphql/types/knowledgesearchresult). Open the type for its fields and nested types.

| Field | Type | Description |
| - | - | - |
| `query` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Query used for scoring. |
| `mode` | [`KnowledgeLookupMode!`](https://veryfront.com/docs/cloud/graphql/types/knowledgelookupmode) | search when results scored positively; browse when no positive matches exist. Returns paths and metadata, falling back to a browse page when nothing matches. |
| `data` | [`[KnowledgeLookupItem!]!`](https://veryfront.com/docs/cloud/graphql/types/knowledgelookupitem) | Knowledge Markdown paths with frontmatter previews. Read selected files (MCP get\_file) before answering knowledge questions. |
| `pageInfo` | [`PageInfo!`](https://veryfront.com/docs/cloud/graphql/types/pageinfo) | endCursor is the opaque cursor of the next page. |
| `returned` | [`Int!`](https://veryfront.com/docs/cloud/graphql/types/int) | |
| `totalMatches` | [`Int!`](https://veryfront.com/docs/cloud/graphql/types/int) | |
| `shard` | [`KnowledgeLookupShard!`](https://veryfront.com/docs/cloud/graphql/types/knowledgelookupshard) | |
| `limit` | [`Int!`](https://veryfront.com/docs/cloud/graphql/types/int) | Page size used for this page. |

Types marked with `!` cannot be null. Lists use `[Type]` notation. The [type index](https://veryfront.com/docs/cloud/graphql/schema.md) lists all published input and response types.

## Example

```graphql title="query.graphql" theme={null}
query KnowledgeSearch($projectReference: ID!, $input: KnowledgeSearchInput!) {
  knowledgeSearch(projectReference: $projectReference, input: $input) {
    limit
    mode
    query
    returned
    totalMatches
    data {
      matchedFields
      path
    }
    pageInfo {
      hasNextPage
      endCursor
      hasPreviousPage
      startCursor
    }
  }
}
```

```json title="variables.json" theme={null}
{
  "projectReference": "00000000-0000-4000-8000-000000000001",
  "input": {}
}
```

<details>
  <summary>Try this query</summary>

  Calls use `https://api.veryfront.com/graphql`. Replace sample values with resources you can access. See [Authentication](https://veryfront.com/docs/cloud/authentication.md) for credentials and permissions.

  Bearer token or API key

  Stored in this tab's session. Clear credential

  Query

  Variables (JSON)
</details>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.