> Source: https://wexa.ai/docs/context/graph-stats

# graph-stats

Counts of the project's context graph, as the console's Context Graph shows them. Needs the `fabric:query.read` grant.

The shape of `result` for `graph-stats` is not recorded here: it was not captured against a live deployment. Call it once and read what comes back rather than assuming a shape.

**Count the graph**

**Wexa MCP server**

```bash
curl -sS -X POST https://fabric.wexa.ai/mcp/$FABRIC_PROJECT_ID \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "Mcp-Session-Id: $MCP_SESSION_ID" \
  -H "content-type: application/json" -H "accept: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"graph-stats","arguments":{}}}'
```

**REST API**

```bash
curl -sS https://fabric.wexa.ai/v1/graph-stats \
  -H "authorization: Bearer $FABRIC_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

**TypeScript SDK**

```ts
import { Fabric } from '@wexa-fabric/sdk'

const fabric = new Fabric()
const result = await fabric.graphStats()
```

**Python SDK**

```python
from wexa import Fabric

fabric = Fabric()
out = fabric.graph_stats()
```

## Parameters

| Parameter | Type | Required | Notes |
| --- | --- | --- | --- |
| `connector_id` | string | Optional | Count only the nodes and relationships this connector ingested. |

**Errors**

- `PolicyDenied` (403): the project's access rules refuse the read (`S5:governance`).

**More details**

Full description from the tool, as the gateway advertises it:

Counts of this project's context graph, as the console's Context Graph shows them: nodes per type,
relationships per type, total nodes, total relationships and nodes with no relationship. Only what
you may see is counted: the counts follow the same access rules as query-context and the console.
Use it for a graph overview or a "what is in the graph" panel without writing Cypher.

### Fields of the result

- `nodeTypes`: `[{type, count}]`, nodes per type.
- `relTypes`: `[{type, count}]`, relationships per type.
- `totalNodes`, `totalEdges`: Totals.
- `orphanNodes`: Nodes with no relationship.
- `sizeReliable`: `false` when the node count scan did not finish in time: do not trust `totalNodes` then.
- `stale`: `true` when the counts are a recent cached answer rather than a fresh scan.
- `warnings`: Sub-scans that did not finish (the other fields are still the counts that did).

Not marked consequential: it is audited lightly and the project's write gate never holds it.

Every tool call works the same way: [How every tool call works](/docs/sdks-and-apis/how-every-tool-call-works).
