> ## 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.

# Get the knowledge graph

> Get knowledge graph.

`knowledgeGraph(projectReference: ID!, input: KnowledgeGraphInput): KnowledgeGraph!`

## 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` | [`KnowledgeGraphInput`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraphinput) | No | |

## Input fields

### input

[`KnowledgeGraphInput`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraphinput)

| Field | Type | Required | Description |
| - | - | - | - |
| `lookupTarget` | [`KnowledgeLookupTargetInput`](https://veryfront.com/docs/cloud/graphql/types/knowledgelookuptargetinput) | No | Source to read; omit for the main preview branch. |
| `callerSelector` | [`JSON`](https://veryfront.com/docs/cloud/graphql/types/json) | No | Caller-selected document scope. Source membership and server-trusted knowledge policy are intersected with this selector before pagination; denied nodes, edges, broken-link labels and counts are filtered. |
| `rootFileVersionId` | [`UUID`](https://veryfront.com/docs/cloud/graphql/types/uuid) | No | Start node by file version ID; or rootPath. |
| `rootPath` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | Start node by path, 1 to 1024 characters. |
| `maxDepth` | [`Int`](https://veryfront.com/docs/cloud/graphql/types/int) | No | Link hops from the root, 0 to 3; omit the root to read the whole visible set. Responses over 512 KiB fail with a size limit (REST 413, MCP PAYLOAD\_TOO\_LARGE). Narrow the graph with root\_path, max\_depth, filters or pagination.limit (GraphQL rootPath, maxDepth, filters or pagination.limit). |
| `filters` | [`KnowledgeFiltersInput`](https://veryfront.com/docs/cloud/graphql/types/knowledgefiltersinput) | No | |
| `pagination` | [`KnowledgeGraphPaginationInput`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraphpaginationinput) | No | |

## Response

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

| Field | Type | Description |
| - | - | - |
| `nodes` | [`[KnowledgeGraphNode!]!`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraphnode) | Visible knowledge files as nodes. Markdown document links are edges; external and broken links are returned separately. Use the graph to find related files. |
| `edges` | [`[KnowledgeGraphEdge!]!`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraphedge) | |
| `externalLinks` | [`[KnowledgeGraphExternalLink!]!`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraphexternallink) | |
| `brokenLinks` | [`[KnowledgeGraphBrokenLink!]!`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraphbrokenlink) | |
| `returnedNodes` | [`Int!`](https://veryfront.com/docs/cloud/graphql/types/int) | |
| `totalNodes` | [`Int!`](https://veryfront.com/docs/cloud/graphql/types/int) | |
| `partial` | [`Boolean!`](https://veryfront.com/docs/cloud/graphql/types/boolean) | True when nodes or links were left out of this page. |
| `linksTruncated` | [`Boolean!`](https://veryfront.com/docs/cloud/graphql/types/boolean) | True when the link count or byte budget left links out. |

[All fields of `KnowledgeGraph`](https://veryfront.com/docs/cloud/graphql/types/knowledgegraph).

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 KnowledgeGraph($projectReference: ID!, $input: KnowledgeGraphInput) {
  knowledgeGraph(projectReference: $projectReference, input: $input) {
    limit
    linksTruncated
    partial
    returnedNodes
    totalNodes
    nodes {
      fileId
      fileVersionId
      path
      reserved
      tags
    }
    edges {
      ordinal
      sourceFileVersionId
      targetFileVersionId
    }
    pageInfo {
      hasNextPage
      endCursor
      hasPreviousPage
      startCursor
    }
  }
}
```

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

<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.