Skip to main content
Glama

list_directives

List all NoJS framework directives to help developers reference available functionality, with optional filtering by category for targeted exploration.

Instructions

List all NoJS directives, optionally filtered by category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoFilter by category: data, state, binding, conditionals, loops, events, styling, forms, routing, animation, dnd, i18n, refs, misc

Implementation Reference

  • Implementation of the list_directives tool handler.
    // ── list_directives ──
    server.tool(
        "list_directives",
        "List all NoJS directives, optionally filtered by category",
        {
            category: z
                .string()
                .optional()
                .describe(
                    'Filter by category: data, state, binding, conditionals, loops, events, styling, forms, routing, animation, dnd, i18n, refs, misc'
                ),
        },
        async ({ category }) => {
            const kb = loadJSON<DirectivesKB>("directives.json");
    
            let directives = kb.directives;
            if (category) {
                directives = directives.filter(
                    (d) => d.category === category.toLowerCase()
                );
            }
    
            if (directives.length === 0) {
                const cats = kb.categories.map((c) => c.id).join(", ");
                return {
                    content: [
                        {
                            type: "text" as const,
                            text: `No directives found for category "${category}". Available categories: ${cats}`,
                        },
                    ],
                };
            }
    
            // Group by category
            const groups: Record<string, typeof directives> = {};
            for (const d of directives) {
                if (!groups[d.category]) groups[d.category] = [];
                groups[d.category].push(d);
            }
    
            let output = `# NoJS Directives${category ? ` (${category})` : ""}\n\n`;
            output += `Total: ${directives.length} directives\n\n`;
    
            for (const [cat, items] of Object.entries(groups)) {
                const catInfo = kb.categories.find((c) => c.id === cat);
                output += `## ${catInfo?.name || cat}\n\n`;
                output += `| Directive | Description |\n|---|---|\n`;
                for (const d of items) {
                    output += `| \`${d.name}\` | ${d.description} |\n`;
                }
                output += `\n`;
            }
    
            return {
                content: [{ type: "text" as const, text: output }],
            };
        }
    );

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/ErickXavier/nojs-mcp'

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