list_all_lists
View all available lists and their item counts to identify existing lists or find forgotten list IDs in the current session.
Instructions
Lists all existing lists and their item counts.
WHEN TO USE:
To see all available lists in the current session
To find a list ID you may have forgotten
To check how many lists exist
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:436-460 (handler)The handler function that executes the list_all_lists tool. It checks if any lists exist using the global 'lists' Map. If none, returns a message. Otherwise, it maps over the lists to create a formatted string of list IDs and their item counts, and returns it in the tool response format.async () => { if (lists.size === 0) { return { content: [ { type: "text", text: "No lists exist. Use create_list to create a new list.", }, ], }; } const listInfo = Array.from(lists.entries()) .map(([id, items]) => `- "${id}": ${items.length} items`) .join("\n"); return { content: [ { type: "text", text: `Found ${lists.size} list(s):\n\n${listInfo}`, }, ], }; },
- src/index.ts:425-461 (registration)The registration of the 'list_all_lists' tool using McpServer's registerTool method, including the tool name, description, empty input schema (no parameters), and the handler function.server.registerTool( "list_all_lists", { description: `Lists all existing lists and their item counts. WHEN TO USE: - To see all available lists in the current session - To find a list ID you may have forgotten - To check how many lists exist`, inputSchema: {}, }, async () => { if (lists.size === 0) { return { content: [ { type: "text", text: "No lists exist. Use create_list to create a new list.", }, ], }; } const listInfo = Array.from(lists.entries()) .map(([id, items]) => `- "${id}": ${items.length} items`) .join("\n"); return { content: [ { type: "text", text: `Found ${lists.size} list(s):\n\n${listInfo}`, }, ], }; }, );
- src/index.ts:427-435 (schema)The tool metadata including description and inputSchema. The inputSchema is empty object {} indicating no input parameters are required.{ description: `Lists all existing lists and their item counts. WHEN TO USE: - To see all available lists in the current session - To find a list ID you may have forgotten - To check how many lists exist`, inputSchema: {}, },
- src/index.ts:125-125 (helper)Global Map storing all created lists by their ID. Used by list_all_lists to iterate and report existing lists.const lists = new Map<string, string[]>();