# See the knowledge graph

The graph shows your knowledge as cards, with arrows for the links between them. It shows the project's knowledge, whatever each agent may read, and links that point nowhere.

## Before you start

You need knowledge. See [Add knowledge](/docs/agents/knowledge.md).

## See the graph

**Studio**

1. In your project, open **Building blocks** > **Knowledge**.
2. Click **Graph**. You should now see up to 50 documents as cards, arrows for up to 100 links between them, and **Next graph page** if there are more.
3. Click **File**.
4. Pick a document, here shipping-guide. You should now see its card and the cards it links to. shipping-guide links to none: "Showing 1 of 1 knowledge document".
5. Click **Clear filters**. You should now see the graph again.
6. Click a card, here Returns policy. You should now see the document open in the editor.

**API**

1. Set `PROJECT` to your project's ID ([Find your IDs](/docs/authentication/api-keys.md#find-your-ids)): `export PROJECT=<id>`.
2. Read the graph, with your [API key](/docs/authentication/api-keys.md). You should now see up to 50 documents under `nodes`, and their links under `edges`, from each link's `source_file_version_id` to its `target_file_version_id`. While `page_info.next` is not null, send it again with `"pagination": {"cursor": "<next>"}` for the next documents:

```bash
curl -X POST https://api.veryfront.com/projects/$PROJECT/knowledge/graph \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### Try it in a sandbox

```playground
step: Set PROJECT | export PROJECT=$VERYFRONT_PROJECT_ID
step: Before you start: three linked documents | curl -X PUT https://api.veryfront.com/projects/$PROJECT/files/knowledge%2Freturns-policy.md -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"content": "---\ntitle: Returns policy\n---\n\nSee the [refund timeline](refund-timeline.md).\n"}' && curl -X PUT https://api.veryfront.com/projects/$PROJECT/files/knowledge%2Frefund-timeline.md -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"content": "---\ntitle: Refund timeline\n---\n\nSee the [shipping guide](shipping-guide.md).\n"}' && curl -X PUT https://api.veryfront.com/projects/$PROJECT/files/knowledge%2Fshipping-guide.md -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{"content": "---\ntitle: Shipping guide\n---\n\nOrders ship within 2 business days.\n"}'
check: curl -X POST https://api.veryfront.com/projects/$PROJECT/knowledge/graph -H "Authorization: Bearer $VERYFRONT_API_KEY" -H "Content-Type: application/json" -d '{}'
expect: "target_file_version_id"
```

This reads the knowledge on the main branch. On a preview branch, send `{"lookup_target": {"kind": "preview_branch", "branch_id": "<id>"}}` instead of `{}`, and on every page, with the branch's `id` from `GET /projects/$PROJECT/branches`.

### Troubleshooting

**If you see `"links_truncated": true`**, the answer left links out of `edges`, and the next pages don't add them back. Read the graph again with fewer documents a page, such as `{"pagination": {"limit": 20}}`, lower it until the answer reads `"links_truncated": false`, then follow `page_info.next` with the same `limit`. At `"limit": 1` it can stay `true`: that document has more links than one answer holds.

## With MCP

1. Call `veryfront__get_knowledge_graph` with `"project_reference": "my-project"`. The project reference is its slug or its ID. On a preview branch, also pass `"lookup_target": { "kind": "preview_branch", "branch_id": "<id>" }` (`veryfront__list_branches` lists them), on every call.
2. It worked when the answer lists documents under `nodes` and their links under `edges`. While `page_info.next` is not null, call it again with `"pagination": { "cursor": "<next>" }`: together the answers hold `total_nodes` documents. `broken_links` lists the links that point nowhere. `links_truncated` true means some links were left out, and the next pages don't add them back: call again with a smaller `"pagination": { "limit": 20 }`, lower it until `links_truncated` is false, then follow `page_info.next` with the same `limit`. At `"limit": 1` it can stay true: that document has more links than one answer holds.

## Next steps

* [Create an agent](/docs/agents/create-agent.md)
* [Upload files](/docs/projects/uploads.md)
