graph-stats
Analyze node and edge counts in a graph store to track relationships and structures within indexed notes, enabling insights into knowledge graphs and semantic connections.
Instructions
Get counts of nodes and edges in the graph store.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp.ts:1290-1294 (handler)The handler for the 'graph-stats' tool call. Validates input schema and invokes graph.stats() to retrieve node and edge counts, returning JSON.case 'graph-stats': { GraphStatsSchema.parse(args ?? {}); const res = graph.stats(); return { content: [{ type: 'text', text: JSON.stringify(res) }] }; }
- src/mcp.ts:184-188 (registration)MCP tool registration defining name, description, and input schema (empty object) for 'graph-stats'.{ name: 'graph-stats', description: 'Get counts of nodes and edges in the graph store.', inputSchema: { type: 'object', properties: {} }, },
- src/types.ts:89-90 (schema)Zod schema for GraphStats input validation (empty schema since tool takes no parameters).export const GraphStatsSchema = z.object({}); export type GraphStatsInput = z.infer<typeof GraphStatsSchema>;
- src/graph.ts:220-224 (helper)Core stats() implementation in SqliteGraphStore class, executing SQL COUNT queries on graph_nodes and graph_edges tables.stats(): { nodes: number; edges: number } { const n = (this.db.prepare(`SELECT COUNT(*) as c FROM graph_nodes`).get() as any).c as number; const e = (this.db.prepare(`SELECT COUNT(*) as c FROM graph_edges`).get() as any).c as number; return { nodes: n, edges: e }; }