# knowledgeGraph

```graphql
query KnowledgeGraph($projectReference: ID!) {
  knowledgeGraph(projectReference: $projectReference) {
    nodes {
      fileId
      fileVersionId
      path
      title
      type
      tags
      reserved
    }
    edges {
      sourceFileVersionId
      targetFileVersionId
      ordinal
    }
    externalLinks {
      sourceFileVersionId
      ordinal
      url
    }
    brokenLinks {
      sourceFileVersionId
      ordinal
      targetPath
    }
    returnedNodes
    totalNodes
    partial
    linksTruncated
    limit
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

Get knowledge graph.

## Arguments

| Name                      | Type                          | Required | Description                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------- | ----------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `projectReference`        | 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           |          |                                                                                                                                                                                                                                                                                                                                                                                                           |
| `input.lookupTarget`      | KnowledgeLookupTargetInput    |          | Source to read; omit for the main preview branch.                                                                                                                                                                                                                                                                                                                                                         |
| `input.callerSelector`    | JSON                          |          | 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.                                                                                                                                                                                              |
| `input.rootFileVersionId` | UUID                          |          | Start node by file version ID; or rootPath.                                                                                                                                                                                                                                                                                                                                                               |
| `input.rootPath`          | String                        |          | Start node by path, 1 to 1024 characters.                                                                                                                                                                                                                                                                                                                                                                 |
| `input.maxDepth`          | Int                           |          | 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).                                                                                                     |
| `input.filters`           | KnowledgeFiltersInput         |          |                                                                                                                                                                                                                                                                                                                                                                                                           |
| `input.pagination`        | KnowledgeGraphPaginationInput |          |                                                                                                                                                                                                                                                                                                                                                                                                           |

## Variables

```json
{
  "projectReference": "string"
}
```

## Responses

| Status | Description                                 |
| ------ | ------------------------------------------- |
| 200    | The KnowledgeGraph! in data.knowledgeGraph. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "query KnowledgeGraph($projectReference: ID!) {\n  knowledgeGraph(projectReference: $projectReference) {\n    nodes {\n      fileId\n      fileVersionId\n      path\n      title\n      type\n      tags\n      reserved\n    }\n    edges {\n      sourceFileVersionId\n      targetFileVersionId\n      ordinal\n    }\n    externalLinks {\n      sourceFileVersionId\n      ordinal\n      url\n    }\n    brokenLinks {\n      sourceFileVersionId\n      ordinal\n      targetPath\n    }\n    returnedNodes\n    totalNodes\n    partial\n    linksTruncated\n    limit\n    pageInfo {\n      hasNextPage\n      hasPreviousPage\n      startCursor\n      endCursor\n    }\n  }\n}",
  "variables": {
    "projectReference": "string"
  }
}'
```

## Example response

```json
{
  "data": {
    "knowledgeGraph": {
      "nodes": [
        {
          "fileId": "string",
          "fileVersionId": "string",
          "path": "string",
          "title": "string",
          "type": "string",
          "tags": [
            "string"
          ],
          "reserved": false
        }
      ],
      "edges": [
        {
          "sourceFileVersionId": "string",
          "targetFileVersionId": "string",
          "ordinal": 0
        }
      ],
      "externalLinks": [
        {
          "sourceFileVersionId": "string",
          "ordinal": 0,
          "url": "https://example.com"
        }
      ],
      "brokenLinks": [
        {
          "sourceFileVersionId": "string",
          "ordinal": 0,
          "targetPath": "string"
        }
      ],
      "returnedNodes": 0,
      "totalNodes": 0,
      "partial": false,
      "linksTruncated": false,
      "limit": 0,
      "pageInfo": {
        "hasNextPage": false,
        "hasPreviousPage": false,
        "startCursor": "string",
        "endCursor": "string"
      }
    }
  }
}
```
