Skip to main content
Glama
halans

Knowledge Base MCP Server

by halans

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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,
          };
        }
      }
    );
  • 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();
    }
Install Server

Other Tools

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/halans/local-mcp-simple'

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