index-list-keys
List and count known keys in MCP Index Notes to organize and manage indexed data, enabling efficient retrieval and analysis of tagged and semantic connections.
Instructions
List known keys and counts.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- src/mcp.ts:1261-1265 (handler)Tool handler for 'index-list-keys': parses optional limit parameter (1-500, default 100), calls db.listKeys() with the limit, and returns the result as JSON array of {key: string, count: number}.case 'index-list-keys': { const parsed = z.object({ limit: z.number().positive().max(500).optional().default(100) }).parse(args ?? {}); const keys = db.listKeys(parsed.limit); return { content: [{ type: 'text', text: JSON.stringify(keys) }] }; }
- src/mcp.ts:154-158 (registration)Registers the MCP tool 'index-list-keys' in the tools array provided to the MCP server, including name, description, and input schema for optional 'limit' parameter.{ name: 'index-list-keys', description: 'List known keys and counts.', inputSchema: { type: 'object', properties: { limit: { type: 'number' } } }, },
- src/mcp.ts:157-157 (schema)JSON schema definition for the tool input: object with optional 'limit' number property.inputSchema: { type: 'object', properties: { limit: { type: 'number' } } },
- src/db.ts:139-142 (helper)Implementation of listKeys in NotesDB (SQLite): SQL query groups notes by key, counts occurrences, orders by descending count then ascending key, limits results, returns array of {key, count}.listKeys(limit = 100) { const rows = this.db.prepare(`SELECT key, COUNT(*) as count FROM notes GROUP BY key ORDER BY count DESC, key ASC LIMIT ?`).all(limit); return rows as Array<{ key: string; count: number }>; }
- src/store.ts:8-8 (schema)TypeScript interface INotesStore defines the listKeys method signature used by all store implementations.listKeys(limit?: number): Array<{ key: string; count: number }>;