Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: {} }, },
  • 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>;
  • 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 }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vjsr007/mcp-index-notes'

If you have feedback or need assistance with the MCP directory API, please join our Discord server