---
name: render-graph
description: "Render an inline PNG of a Neo4j subgraph for the operator using the graph-render MCP tool. Use when the operator asks to 'see the graph', 'show me the subgraph around X', 'render the owner subgraph', or any request whose outcome is a picture of nodes-and-edges they can look at in chat. Never substitute Mermaid, ASCII, or any other graph stand-in: graph-render is the only correct surface, and if it refuses (foreign account, missing node, empty neighbourhood, draw error) surface the structured error to the operator and stop. The image uses the same palette and short-label strings as the admin /graph page; node positions will differ because the renderer is d3-force not vis-network."
---

# render-graph

Invoked by the admin agent directly.

When the operator asks for a picture of a subgraph:

1. Resolve the root node's `elementId` first — usually via `memory-search`
   or another graph tool the operator already pointed you at. Never pass a
   property like `name` as `nodeId`.
2. Pick a `hopDepth` between 0 and 3. Default to 1 unless the operator
   asks for the wider neighbourhood. Depth 3 on a busy node will hit the
   200-node cap and return a `truncated` envelope.
3. Call `graph-render` with `{ accountId, nodeId, hopDepth }`.
4. If the result is `ok: true`, the PNG is at the returned `path` under
   `output/graph-render/`. The render is not shown inline, so deliver it by
   surface: on a message channel (web chat, WhatsApp, Telegram) call
   `SendUserFile` with that path and the platform forwards the PNG to that
   conversation as a real attachment; on the admin dashboard the same path
   appears in the Artefacts panel (downloadable) and is reachable on the
   file share. Either way, state that exact path in your reply. Add a
   one-line caption, say how many nodes are in view, and — if `truncated`
   is present — that there were more nodes than the cap.
5. If the result is `ok: false`, surface the structured `reason` and
   `message` to the operator verbatim. Do not retry with a different
   nodeId without their input. Do not fall back to Mermaid, ASCII, or any
   other graph substitute.

## Reasons graph-render can refuse

- `scope` — the nodeId belongs to a different account, or does not exist.
- `empty` — the root exists but its neighbourhood is empty after the
  trash filter.
- `cap-exceeded` — reserved for future use; today subgraphs above 200
  nodes return `ok: true` with a `truncated` envelope.
- `draw-error` — the canvas renderer failed. The message contains the
  underlying error; if it mentions a missing font, the system font fallback
  is unavailable on this device.
- `invalid-input` — `hopDepth` was outside the 0-3 range.
