list_categories
Retrieve all available topic categories from the knowledge base to understand what subjects are covered and navigate content effectively.
Instructions
List all available categories in the knowledge base. Helpful for understanding what topics are covered.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:132-163 (handler)Registration of the list_categories tool using server.tool() in src/index.ts.
// Register the list_categories tool server.tool( "list_categories", "List all available categories in the knowledge base. Helpful for understanding what topics are covered.", {}, async () => { try { const categories = getCategories(); return { content: [ { type: "text" as const, text: `# Available Categories\n\nThe knowledge base covers the following topics:\n\n${categories.map((cat) => `- ${cat}`).join("\n")}`, }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error"; return { content: [ { type: "text" as const, text: `Error listing categories: ${errorMessage}`, }, ], isError: true, }; } } ); - src/search.ts:143-155 (helper)The getCategories helper function that performs the core logic for the list_categories tool.
* Get all available categories */ export function getCategories(): string[] { const knowledge = getKnowledge(); const categories = new Set<string>(); for (const chunk of knowledge.chunks) { categories.add(chunk.category); } return Array.from(categories).sort(); }